Repository Analysis

SWE-agent/SWE-agent

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

22.4 Moderate AI signal View on GitHub
22.4
Adjusted Score
22.4
Raw Score
100%
Time Factor
2026-05-25
Last Push
19,371
Stars
Python
Language
26,710
Lines of Code
287
Files
322
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 1HIGH 46MEDIUM 37LOW 238

Pattern Findings

322 matches across 15 categories. Click a row to expand file-level details.

Cross-File Repetition42 hits · 210 pts
SeverityFileLineSnippet
HIGHsweagent/agent/problem_statement.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/agent/problem_statement.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/agent/problem_statement.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/agent/problem_statement.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/agent/problem_statement.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/environment/repo.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/environment/repo.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/environment/repo.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/environment/repo.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/run/batch_instances.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/run/batch_instances.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/run/batch_instances.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/run/batch_instances.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/run/batch_instances.py0discriminator for (de)serialization/cli. do not change.
HIGHsweagent/agent/problem_statement.py0any additional data to be added to the instance. this data will be available when formatting prompt templates.
HIGHsweagent/agent/problem_statement.py0any additional data to be added to the instance. this data will be available when formatting prompt templates.
HIGHsweagent/agent/problem_statement.py0any additional data to be added to the instance. this data will be available when formatting prompt templates.
HIGHsweagent/agent/problem_statement.py0any additional data to be added to the instance. this data will be available when formatting prompt templates.
HIGHsweagent/run/batch_instances.py0any additional data to be added to the instance. this data will be available when formatting prompt templates.
HIGHsweagent/environment/repo.py0the commit to reset the repository to. the default is head, i.e., the latest commit. you can also set this to a branch n
HIGHsweagent/environment/repo.py0the commit to reset the repository to. the default is head, i.e., the latest commit. you can also set this to a branch n
HIGHsweagent/environment/repo.py0the commit to reset the repository to. the default is head, i.e., the latest commit. you can also set this to a branch n
HIGHsweagent/environment/repo.py0issued after the copy operation or when the environment is reset.
HIGHsweagent/environment/repo.py0issued after the copy operation or when the environment is reset.
HIGHsweagent/environment/repo.py0issued after the copy operation or when the environment is reset.
HIGHsweagent/run/batch_instances.py0regular expression to filter the instances by instance id.
HIGHsweagent/run/batch_instances.py0regular expression to filter the instances by instance id.
HIGHsweagent/run/batch_instances.py0regular expression to filter the instances by instance id.
HIGHsweagent/run/batch_instances.py0regular expression to filter the instances by instance id.
HIGHsweagent/run/batch_instances.py0regular expression to filter the instances by instance id.
HIGHsweagent/run/batch_instances.py0shuffle the instances (before filtering and slicing).
HIGHsweagent/run/batch_instances.py0shuffle the instances (before filtering and slicing).
HIGHsweagent/run/batch_instances.py0shuffle the instances (before filtering and slicing).
HIGHsweagent/run/batch_instances.py0shuffle the instances (before filtering and slicing).
HIGHsweagent/run/batch_instances.py0shuffle the instances (before filtering and slicing).
HIGHsweagent/run/batch_instances.py0select only a slice of the instances (after filtering by `filter`). possible values are stop or start:stop or start:stop
HIGHsweagent/run/batch_instances.py0select only a slice of the instances (after filtering by `filter`). possible values are stop or start:stop or start:stop
HIGHsweagent/run/batch_instances.py0select only a slice of the instances (after filtering by `filter`). possible values are stop or start:stop or start:stop
HIGHsweagent/run/batch_instances.py0select only a slice of the instances (after filtering by `filter`). possible values are stop or start:stop or start:stop
HIGHsweagent/run/run_replay.py0path to a .env file to load environment variables from.
HIGHsweagent/run/run_single.py0path to a .env file to load environment variables from.
HIGHsweagent/run/run_batch.py0path to a .env file to load environment variables from.
Hyper-Verbose Identifiers116 hits · 126 pts
SeverityFileLineSnippet
LOWtools/web_browser/lib/web_browser_utils.py98def _print_response_with_metadata(response):
LOWtools/web_browser/lib/web_browser_utils.py120def _autosave_screenshot_from_response(response, mode):
LOWtests/test_run_batch.py49def test_empty_instances_simple(test_data_sources_path: Path, tmp_path: Path):
LOWtests/test_run_batch.py69def test_empty_instances_expert(test_data_sources_path: Path, tmp_path: Path):
LOWtests/test_run_batch.py93# def test_run_batch_swe_bench_instances(tmp_path: Path):
LOWtests/test_parsing.py29def test_thought_action_parser():
LOWtests/test_parsing.py39def test_xml_thought_action_parser():
LOWtests/test_parsing.py83def test_function_calling_parser():
LOWtests/test_parsing.py128def test_function_calling_parser_error_message():
LOWtests/test_utils.py9def test_convert_path_to_abspath():
LOWtests/test_utils.py14def test_convert_paths_to_abspath():
LOWtests/conftest.py40def test_ctf_trajectories_path(test_data_path) -> Path:
LOWtests/conftest.py123def swe_agent_test_repo_clone(tmp_path):
LOWtests/test_batch_instance.py11def test_simple_batch_from_swe_bench_to_full_batch_instance(test_data_sources_path):
LOWtests/test_batch_instance.py34def test_get_swe_bench_instances():
LOWtests/test_agent.py31def thought_action_agent_config():
LOWtests/test_agent.py41def function_calling_agent_config():
LOWtests/test_agent.py149def test_run_step_by_step_checking_history(dummy_env: SWEEnv, default_agent: DefaultAgent, tmp_path):
LOWtests/test_agent.py211def test_show_no_output_template(dummy_env: SWEEnv, default_agent: DefaultAgent, tmp_path):
LOWtests/test_agent.py224def test_successful_submission(dummy_env: SWEEnv, default_agent: DefaultAgent, tmp_path):
LOWtests/test_swesmith.py25 def test_with_mirror_and_token(self):
LOWtests/test_swesmith.py38 def test_with_mirror_no_token(self):
LOWtests/test_swesmith.py116 def test_other_http_error_raises(self, mock_urlopen):
LOWtests/test_swesmith.py191 def test_private_repo_no_token_raises(self, mock_private, tmp_path):
LOWtests/test_run_hooks.py15def open_pr_hook_init_for_sop():
LOWtests/test_run_hooks.py33def test_should_open_pr_fail_submission(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py39def test_should_open_pr_fail_exit(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py45def test_should_open_pr_fail_invalid_url(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py51def test_should_open_pr_fail_closed(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py57def test_should_open_pr_fail_assigned(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py63def test_should_open_pr_fail_locked(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py69def test_should_open_pr_fail_has_pr(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py75def test_should_open_pr_success_has_pr_override(open_pr_hook_init_for_sop, agent_run_result):
LOWtests/test_run_hooks.py82def test_save_apply_patch_hook_concurrent_workers_save_to_correct_dirs(tmp_path):
LOWtests/test_run.py6def test_run_cli_no_arg_error():
LOWtests/test_run.py30def test_run_cli_subcommand_help():
LOWtests/test_env.py21def test_init_swe_env_conservative_clone(test_env_args):
LOWtests/test_env.py51def test_env_communicate_with_handling(test_env_args):
LOWtests/test_env.py57def test_env_communicate_with_handling_timeout(test_env_args):
LOWtests/test_env.py64def test_env_interrupt_session(test_env_args):
LOWtests/test_run_single.py24def test_run_single_raises_exception():
LOWtests/test_run_single.py33def agent_config_with_commands():
LOWtests/test_run_single.py84def test_run_ies_repo_ps_matrix(
LOWtests/utils.py7def make_python_tool_importable(file_path: str | Path, module_name: str | None = None) -> None:
LOWtests/test_tools_command_parsing.py6def test_command_parsing_formats():
LOWtests/test_tools_command_parsing.py82def test_argument_name_patterns():
LOWtests/test_tools_command_parsing.py107def test_signature_argument_consistency():
LOWtests/test_tools_command_parsing.py131def test_function_calling_tool_generation():
LOWtests/test_tools_command_parsing.py176def test_custom_argument_format():
LOWtests/test_models.py41def test_user_agent_header_default():
LOWtests/test_models.py63def test_user_agent_header_preserves_existing():
LOWtests/test_models.py86def test_user_agent_header_with_other_extra_headers():
LOWtests/test_env_utils.py19def test_format_trajectory_markdown(test_trajectory):
LOWtests/test_env_utils.py25def test_remove_triple_backticks():
LOWtests/test_env_utils.py44def test_parse_gh_repo_url_fails():
LOWtests/test_env_utils.py61def test_parse_gh_issue_url_fails():
LOWtests/test_env_utils.py73def test_get_associated_commit_urls():
LOWtests/test_quick_stats.py10def test_quick_stats_empty_directory():
LOWtests/test_quick_stats.py17def test_quick_stats_test_data(test_trajectories_path: Path):
LOWtests/test_problem_statement_multimodal.py23 def test_get_problem_statement_no_images(self):
56 more matches not shown…
Excessive Try-Catch Wrapping52 hits · 81 pts
SeverityFileLineSnippet
MEDIUMtools/windowed/lib/windowed_file.py210 print(f"Error: Text not found: {search}")
MEDIUMtools/windowed/lib/windowed_file.py244 print(f"Error: Text not found: {search}")
LOWtools/web_browser/lib/web_browser_utils.py61 except Exception as e:
MEDIUMtools/web_browser/lib/web_browser_utils.py58def wrapper(*args, **kwargs):
LOWtools/web_browser/lib/browser_manager.py230 except Exception:
LOWtools/web_browser/lib/browser_manager.py240 except Exception:
LOWtools/web_browser/lib/browser_manager.py247 except Exception:
LOWdocs/usage/memory_sentinel.py134 except Exception as e:
LOWdocs/usage/hello_world_output.txt187 except Exception as e:
MEDIUMdocs/usage/hello_world_output.txt188 print(f"Error: {type(e).__name__}: {e}")'
LOWdocs/usage/hello_world_output.txt333 except Exception as e:
MEDIUMdocs/usage/hello_world_output.txt334 print(f"Error: {type(e).__name__}: {e}")' --new_str 'if __name__ == "__main__":
LOWdocs/usage/hello_world_output.txt339 except Exception as e:
MEDIUMdocs/usage/hello_world_output.txt340 print(f"Error: {type(e).__name__}: {e}")
LOWdocs/usage/hello_world_output.txt346 except Exception as e:
MEDIUMdocs/usage/hello_world_output.txt347 print(f"Error: {type(e).__name__}: {e}")
LOWdocs/usage/hello_world_output.txt353 except Exception as e:
MEDIUMdocs/usage/hello_world_output.txt354 print(f"Error: {type(e).__name__}: {e}")'
MEDIUMdocs/usage/hello_world_output.txt370 13 print(f"Error: {type(e).__name__}: {e}")
MEDIUMdocs/usage/hello_world_output.txt377 20 print(f"Error: {type(e).__name__}: {e}")
MEDIUMdocs/usage/hello_world_output.txt384 27 print(f"Error: {type(e).__name__}: {e}")
MEDIUMdocs/usage/hello_world_output.txt516 + print(f"Error: {type(e).__name__}: {e}")
MEDIUMdocs/usage/hello_world_output.txt523 + print(f"Error: {type(e).__name__}: {e}")
MEDIUMdocs/usage/hello_world_output.txt530 + print(f"Error: {type(e).__name__}: {e}")
LOWsweagent/__init__.py57 except Exception:
LOWsweagent/__init__.py67 except Exception:
LOWsweagent/tools/tools.py283 except Exception:
LOWsweagent/inspector/static.py43except Exception as e:
LOWsweagent/inspector/static.py82 except Exception:
MEDIUMsweagent/inspector/static.py49def _load_file(file_name, gold_patches, test_patches):
LOWsweagent/utils/config.py26 except Exception:
LOWsweagent/agent/models.py745 except Exception as e:
LOWsweagent/agent/agents.py345 except Exception as e:
LOWsweagent/agent/agents.py371 except Exception as e:
LOWsweagent/agent/agents.py860 except Exception as e:
LOWsweagent/agent/agents.py891 except Exception as e:
LOWsweagent/agent/agents.py978 except Exception as f:
LOWsweagent/agent/agents.py1053 except Exception as e:
LOWsweagent/agent/agents.py1205 except Exception as e:
LOWsweagent/agent/problem_statement.py208 except Exception as e:
LOWsweagent/agent/problem_statement.py271 except Exception as e:
LOWsweagent/agent/reviewer.py256 except Exception as e:
LOWsweagent/agent/reviewer.py303 except Exception as e:
LOWsweagent/agent/reviewer.py342 except Exception as e:
LOWsweagent/agent/reviewer.py362 except Exception as e:
LOWsweagent/agent/reviewer.py430 except Exception as e:
LOWsweagent/run/quick_stats.py46 except Exception as e:
LOWsweagent/run/remove_unfinished.py30 except Exception as e:
LOWsweagent/run/run_batch.py319 except Exception as e:
LOWsweagent/run/run_batch.py365 except Exception:
LOWsweagent/run/run_batch.py402 except Exception as e:
MEDIUMsweagent/run/run_batch.py189def _model_id(self) -> str:
Unused Imports39 hits · 39 pts
SeverityFileLineSnippet
LOWtools/windowed/lib/windowed_file.py1
LOWtools/windowed/lib/windowed_file.py2
LOWtools/windowed/lib/windowed_file.py4
LOWtools/registry/lib/registry.py4
LOWtools/registry/lib/registry.py4
LOWtools/registry/lib/registry.py4
LOWtools/web_browser/lib/web_browser_utils.py1
LOWtools/web_browser/lib/browser_manager.py1
LOWtools/web_browser/lib/web_browser_config.py1
LOWtools/web_browser/lib/web_browser_config.py4
LOWtests/test_parsing.py1
LOWtests/test_utils.py1
LOWtests/conftest.py1
LOWtests/test_packaging.py1
LOWtests/test_swesmith.py1
LOWtests/test_run.py1
LOWtests/test_env.py1
LOWtests/test_run_single.py1
LOWtests/test_run_replay.py1
LOWtests/test_models.py1
LOWtests/test_env_utils.py1
LOWtests/test_quick_stats.py1
LOWtests/tools/test_split_string.py1
LOWtests/test_commands/_interactive_dummy.py2
LOWtests/test_data/data_sources/ctf/crypto/Katy/solver.py1
LOWsweagent/__init__.py1
LOWsweagent/types.py7
LOWsweagent/tools/bundle.py1
LOWsweagent/tools/commands.py19
LOWsweagent/inspector/server.py1
LOWsweagent/inspector/static.py1
LOWsweagent/utils/config.py1
LOWsweagent/utils/log.py1
LOWsweagent/agent/history_processors.py1
LOWsweagent/agent/models.py1
LOWsweagent/agent/agents.py1
LOWsweagent/agent/reviewer.py5
LOWsweagent/agent/hooks/abstract.py7
LOWsweagent/run/run_traj_to_demo.py6
Redundant / Tautological Comments19 hits · 26 pts
SeverityFileLineSnippet
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml84 \ return fi # Check if the file already exists if [ -e \"\
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml94 code: 'submit() { cd $ROOT # Check if the patch file exists and is non-empty if
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml144 code: 'search_file() { # Check if the first argument is provided if [
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml153 file is open fi local file="$CURRENT_FILE" # Set file to the
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml156 -nH -- "$search_term" "$file") # Check if no matches were found if [
LOW…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml226 "$CURRENT_FILE")_backup" # Read the file line by line into an array mapfile
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml85 \ return fi # Check if the file already exists if [ -e \"\
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml95 code: 'submit() { cd $ROOT # Check if the patch file exists and is non-empty if
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml145 code: 'search_file() { # Check if the first argument is provided if [
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml154 file is open fi local file="$CURRENT_FILE" # Set file to the
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml157 -nH -- "$search_term" "$file") # Check if no matches were found if [
LOW…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml227 "$CURRENT_FILE")_backup" # Read the file line by line into an array mapfile
LOWsweagent/tools/parsing.py155 # Check if it's not nested within another block
LOWsweagent/tools/parsing.py293 # Check if all required arguments are there
LOWsweagent/tools/parsing.py300 # Check if all arguments are valid
LOWsweagent/tools/parsing.py488 # Check if required keys are present
LOWsweagent/tools/parsing.py501 # Check if required keys are present in 'command' object
LOWsweagent/run/run_batch.py383 # Check if there's an existing trajectory for this instance
LOWsweagent/run/hooks/open_pr.py231 # Check if adding this step would exceed the character limit
Self-Referential Comments8 hits · 23 pts
SeverityFileLineSnippet
MEDIUMconfig/bash_only.yaml130 ### Create a new file:
MEDIUMtests/test_quick_stats.py19 # Create a sample .traj file with required structure
MEDIUMtests/test_quick_stats.py24 # Create a minimal valid .traj file
MEDIUM…_from_url__t-0.00__p-0.95__c-3.00__install-1/args.yaml86 \ return fi # Create the file an empty new line printf \"\\\
MEDIUM…__default__t-0.00__p-0.95__c-3.00__install-1/args.yaml87 \ return fi # Create the file an empty new line printf \"\\\
MEDIUMsweagent/environment/swe_env.py62 """This class represents the environment in which we solve the tasks.
MEDIUMsweagent/run/rich_test.py39 # Create a spinner for this task
MEDIUMsweagent/run/common.py196 """This class implements a basic CLI for SWE-agent. It is based on pydantic-settings, i.e., takes
Deep Nesting22 hits · 22 pts
SeverityFileLineSnippet
LOWtools/web_browser/lib/browser_manager.py216
LOWdocs/usage/memory_sentinel.py95
LOWsweagent/tools/parsing.py467
LOWsweagent/tools/utils.py8
LOWsweagent/tools/utils.py46
LOWsweagent/inspector/server.py295
LOWsweagent/inspector/server.py254
LOWsweagent/inspector/static.py49
LOWsweagent/inspector/static.py96
LOWsweagent/utils/log.py57
LOWsweagent/utils/log.py93
LOWsweagent/utils/log.py160
LOWsweagent/agent/history_processors.py320
LOWsweagent/agent/models.py328
LOWsweagent/agent/models.py875
LOWsweagent/agent/models.py384
LOWsweagent/agent/models.py840
LOWsweagent/agent/problem_statement.py293
LOWsweagent/agent/reviewer.py40
LOWsweagent/run/run.py70
LOWsweagent/run/compare_runs.py69
LOWsweagent/run/run_batch.py268
Decorative Section Separators7 hits · 21 pts
SeverityFileLineSnippet
MEDIUMsweagent/tools/tools.py250 # --------------------
MEDIUMsweagent/tools/tools.py315 # -------------
MEDIUMsweagent/tools/tools.py370 # -----------------------------
MEDIUMsweagent/agent/history_processors.py20# -----------------
MEDIUMsweagent/agent/history_processors.py71# ------------------
MEDIUMsweagent/agent/agents.py522 # ----------
MEDIUMsweagent/agent/reviewer.py579 # ----------
Slop Phrases6 hits · 18 pts
SeverityFileLineSnippet
MEDIUMconfig/default_backticks.yaml2# This template is heavily inspired by anthropic's computer use demo, but you can use
MEDIUMconfig/default.yaml2# This template is heavily inspired by anthropic's computer use demo, but you can use
MEDIUMconfig/demo/no_instructions.yaml2# This template is heavily inspired by anthropic's computer use demo, but you can use
MEDIUMconfig/demo/only_bash.yaml2# This template is heavily inspired by anthropic's computer use demo, but you can use
MEDIUMconfig/demo/default.yaml2# This template is heavily inspired by anthropic's computer use demo, but you can use
MEDIUMconfig/benchmarks/anthropic_filemap_multilingual.yaml1# This template is heavily inspired by anthropic, but you can use it with any LM. It is almost
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippet
CRITICALtests/test_data/data_sources/debug_20240322.json1[{"repo": "scikit-learn/scikit-learn", "instance_id": "scikit-learn__scikit-learn-11574", "base_commit": "dd69361a0d9c6c
Over-Commented Block6 hits · 6 pts
SeverityFileLineSnippet
LOWmkdocs.yml161 - assets/mkdocstrings.css
LOWmkdocs.yml181 # note: >-
LOWtests/test_run_batch.py101# "test",
LOWtests/tools/test_default_utils.py101# cmd = f"{sys.executable} {DEFAULT_TOOLS_BIN}/goto 50"
LOW…test_data/data_sources/ctf/misc/networking_1/README.md1# Networking 1
LOW.devcontainer/sample_keys.cfg1# All keys are commented out by default. Make sure to remove the leading '#' of the relevant lines
Magic Placeholder Names1 hit · 5 pts
SeverityFileLineSnippet
HIGHdocs/installation/keys.md29See the following links for tutorials on obtaining [Anthropic](https://docs.anthropic.com/en/api/getting-started), [Open
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippet
HIGHsweagent/agent/agents.py856 submission_command = "git add -A && git diff --cached > /root/model.patch"
Docstring Block Structure1 hit · 5 pts
SeverityFileLineSnippet
HIGHsweagent/agent/problem_statement.py219Download an image from URL and convert it to base64 markdown format. Args: url: The URL of the imag
Synthetic Comment Markers1 hit · 2 pts
SeverityFileLineSnippet
HIGHdocs/usage/memory_sentinel.py13Script was generated by Claude 3.7 with the following prompt: