{"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 \n \n\n \n HTML\n end","complexity_score":24.8,"ast_json":"{\"type\":\"def\",\"children\":[\"html\",{\"type\":\"args\",\"children\":[]},{\"type\":\"send\",\"children\":[{\"type\":\"dstr\",\"children\":[{\"type\":\"str\",\"children\":[\"Post by @#{object.account.pretty_acct}@#{provider_name}\nView on Mastodon\n \n
\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\"\\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 \"Post by @\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[{\"type\":\"send\",\"children\":[null,\"object\"]},\"account\"]},\"pretty_acct\"]}]},{\"type\":\"str\",\"children\":[\"@\"]},{\"type\":\"begin\",\"children\":[{\"type\":\"send\",\"children\":[null,\"provider_name\"]}]},{\"type\":\"str\",\"children\":[\"\\n\"]},{\"type\":\"str\",\"children\":[\"View on Mastodon\\n\"]},{\"type\":\"str\",\"children\":[\" \\n\"]},{\"type\":\"str\",\"children\":[\"