Repository Analysis

locustio/locust

Write scalable load tests in plain Python 🚗💨

17.3 Moderate AI signal View on GitHub
17.3
Adjusted Score
17.3
Raw Score
100%
Time Factor
2026-05-26
Last Push
27,838
Stars
Python
Language
46,423
Lines of Code
343
Files
671
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 3HIGH 28MEDIUM 34LOW 606

Pattern Findings

671 matches across 13 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers449 hits · 378 pts
SeverityFileLineSnippet
LOWlocust/web.py381 def _download_csv_suggest_file_name(suggest_filename_prefix: str) -> str:
LOWlocust/web.py419 def request_stats_full_history_csv() -> Response:
LOWlocust/env.py255 def _remove_user_classes_with_weight_zero(self) -> None:
LOWlocust/env.py290 def _validate_user_class_name_uniqueness(self):
LOWlocust/env.py299 def _validate_shape_class_instance(self):
LOWlocust/log.py88def greenlet_exception_logger(logger, level=logging.CRITICAL):
LOWlocust/dispatch.py129 def dispatch_iteration_durations(self) -> list[float]:
LOWlocust/dispatch.py271 def _wait_between_dispatch_iteration_context(self) -> Generator[None]:
LOWlocust/dispatch.py313 def _remove_users_from_workers(self) -> dict[str, dict[str, int]]:
LOWlocust/dispatch.py391 def _fast_users_on_workers_copy(users_on_workers: dict[str, dict[str, int]]) -> dict[str, dict[str, int]]:
LOWlocust/opentelemetry.py142def _setup_auto_instrumentation():
LOWlocust/stats.py161def calculate_response_time_percentile(response_times: dict[int, int], num_requests: int, percent: float) -> int:
LOWlocust/stats.py600 def get_response_time_percentile(self, percent: float) -> int:
LOWlocust/stats.py609 def get_current_response_time_percentile(self, percent: float) -> int | None:
LOWlocust/stats.py824def setup_distributed_stats_event_listeners(events: Events, stats: RequestStats) -> None:
LOWlocust/stats.py901def get_percentile_stats_summary(stats: RequestStats) -> list[str]:
LOWlocust/stats.py1266def validate_stats_configuration() -> None:
LOWlocust/clients.py533 def build_connection_pool_key_attributes(self, request, verify, cert=None):
LOWlocust/runners.py851 def _wait_for_workers_report_after_ramp_up(self) -> float:
LOWlocust/runners.py1191 def reported_user_classes_count(self) -> dict[str, int]:
LOWlocust/runners.py1340 def heartbeat_timeout_checker(self) -> NoReturn:
LOWlocust/runners.py1519def _format_user_classes_count_for_log(user_classes_count: dict[str, int]) -> str:
LOWlocust/runners.py1526def _aggregate_dispatched_users(d: dict[str, dict[str, int]]) -> dict[str, int]:
LOWlocust/main.py86def merge_locustfiles_content(
LOWlocust/main.py513 def spawn_run_time_quit_greenlet():
LOWlocust/argument_parser.py96 def secret_args_included_in_web_ui(self) -> dict[str, configargparse.Action]:
LOWlocust/argument_parser.py104 def required_args_included_in_web_ui(self) -> dict[str, configargparse.Action]:
LOWlocust/argument_parser.py112 def multiple_args_included_in_web_ui(self) -> dict[str, configargparse.Action]:
LOWlocust/argument_parser.py192def download_locustfile_from_url(url: str) -> str:
LOWlocust/argument_parser.py219def get_empty_argument_parser(add_help=True, default_config_files=DEFAULT_CONFIG_FILES) -> LocustArgumentParser:
LOWlocust/argument_parser.py263def download_locustfile_from_master(master_host: str, master_port: int) -> str:
LOWlocust/argument_parser.py370def parse_locustfiles_from_master(locustfile_sources) -> list[str]:
LOWlocust/argument_parser.py388def retrieve_locustfiles_from_master(options) -> list[str]:
LOWlocust/argument_parser.py403def raise_argument_type_error(err_msg):
LOWlocust/test/test_parser.py38 def test_parse_options_from_conf_file(self):
LOWlocust/test/test_parser.py433 def test_find_locustfiles_with_multiple_locustfiles(self):
LOWlocust/test/test_parser.py443 def test_find_locustfiles_error_for_invalid_file_extension(self):
LOWlocust/test/test_parser.py450 def test_find_locustfiles_error_if_multiple_values_for_directory(self):
LOWlocust/test/test_parser.py60 def test_parse_two_line_conf_file(self): # there was an issue with conf files identified as toml
LOWlocust/test/test_parser.py70 def test_parse_options_from_toml_file(self):
LOWlocust/test/test_parser.py135 def test_parse_options_from_env(self):
LOWlocust/test/test_parser.py194 def test_parse_locustfile_multiple_files(self):
LOWlocust/test/test_parser.py208 def test_parse_locustfile_with_directory(self):
LOWlocust/test/test_parser.py219 def test_parse_locustfile_with_nested_directory(self):
LOWlocust/test/test_parser.py243 def test_parse_locustfile_with_directory_ignores_invalid_filenames(self):
LOWlocust/test/test_parser.py258 def test_parse_locustfile_empty_directory_error(self):
LOWlocust/test/test_parser.py268 def test_parse_locustfile_and_directory(self):
LOWlocust/test/test_parser.py282 def test_parse_multiple_directories(self):
LOWlocust/test/test_parser.py295 def test_parse_locustfile_invalid_directory_error(self):
LOWlocust/test/test_parser.py305 def test_unknown_command_line_arg(self):
LOWlocust/test/test_parser.py352 def test_custom_argument_help_message(self):
LOWlocust/test/test_parser.py371 def test_custom_argument_included_in_web_ui(self):
LOWlocust/test/test_parser.py406 def test_find_locustfiles_with_is_directory(self):
LOWlocust/test/test_parser.py417 def test_find_locustfiles_error_if_directory_doesnt_exist(self):
LOWlocust/test/test_parser.py422 def test_find_locustfiles_ignores_invalid_files_in_directory(self):
LOWlocust/test/test_dispatch.py1083 # def test_ramp_down_users_on_workers_respecting_weight(self):
LOWlocust/test/test_dispatch.py787 def test_users_are_distributed_evenly_across_hosts(self):
LOWlocust/test/test_dispatch.py851 def test_implementation_of_dispatch_distribution_with_gcd(self):
LOWlocust/test/test_dispatch.py883 def test_implementation_of_dispatch_distribution_with_gcd_float_weight(self):
LOWlocust/test/test_dispatch.py922 def test_wait_between_dispatch(self):
389 more matches not shown…
Cross-File Repetition28 hits · 140 pts
SeverityFileLineSnippet
HIGHlocust/shape.py0meta class for the main user class. it's used to allow user classes to specify task execution ratio using an {task:int}
HIGHlocust/user/task.py0meta class for the main user class. it's used to allow user classes to specify task execution ratio using an {task:int}
HIGHlocust/user/users.py0meta class for the main user class. it's used to allow user classes to specify task execution ratio using an {task:int}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_dispatch.py0final distribution should be {"user1": 3, "user2": 3, "user3": 3}
HIGHlocust/test/test_main.py0from locust import httpuser, task, constant class quickstartuser(httpuser): wait_time = constant(1) @task def hello_worl
HIGHlocust/test/test_main.py0from locust import httpuser, task, constant class quickstartuser(httpuser): wait_time = constant(1) @task def hello_worl
HIGHlocust/test/test_main.py0from locust import httpuser, task, constant class quickstartuser(httpuser): wait_time = constant(1) @task def hello_worl
HIGHlocust/test/test_main.py0from locust import httpuser, task, constant class quickstartuser(httpuser): wait_time = constant(1) @task def hello_worl
HIGHlocust/test/test_main.py0from locust import user, task, constant class user1(user): wait_time = constant(1) @task def t(self): pass
HIGHlocust/test/test_main.py0from locust import user, task, constant class user1(user): wait_time = constant(1) @task def t(self): pass
HIGHlocust/test/test_main.py0from locust import user, task, constant class user1(user): wait_time = constant(1) @task def t(self): pass
HIGHlocust/test/test_main.py0from locust import user, task, constant class user1(user): wait_time = constant(1) @task def t(self): pass
HIGHexamples/custom_wait_function.py0user class that does requests to the locust web server running on localhost
HIGHexamples/basic.py0user class that does requests to the locust web server running on localhost
HIGHexamples/multiple_hosts.py0user class that does requests to the locust web server running on localhost
HIGHexamples/grpc/hello_pb2_grpc.py0missing associated documentation comment in .proto file.
HIGHexamples/grpc/hello_pb2_grpc.py0missing associated documentation comment in .proto file.
HIGHexamples/grpc/hello_pb2_grpc.py0missing associated documentation comment in .proto file.
HIGHexamples/grpc/hello_pb2_grpc.py0missing associated documentation comment in .proto file.
Decorative Section Separators17 hits · 58 pts
SeverityFileLineSnippet
MEDIUMlocust/test/test_csv_request_logger.py65 # ------------------------------------------------------------------
MEDIUMlocust/contrib/milvus.py269# ----------------------------------
MEDIUMlocust/contrib/milvus.py271# ----------------------------------
MEDIUMlocust/contrib/qdrant.py133# ----------------------------------
MEDIUMlocust/contrib/qdrant.py135# ----------------------------------
MEDIUMlocust/contrib/csv_request_logger.py108 # ------------------------------------------------------------------
MEDIUMlocust/contrib/csv_request_logger.py110 # ------------------------------------------------------------------
MEDIUMlocust/contrib/csv_request_logger.py135 # ------------------------------------------------------------------
MEDIUMlocust/contrib/csv_request_logger.py137 # ------------------------------------------------------------------
MEDIUMdocs/conf.py91# ---------------------
MEDIUMdocs/conf.py168# -----------------------
MEDIUM.github/workflows/tests.yml23 #-------------------------
MEDIUM.github/workflows/tests.yml25 #-------------------------
MEDIUM.github/workflows/tests.yml127 #-------------------------
MEDIUM.github/workflows/tests.yml129 #-------------------------
MEDIUM.github/workflows/tests.yml383 # -------------------------
MEDIUM.github/workflows/tests.yml385 # -------------------------
Unused Imports60 hits · 58 pts
SeverityFileLineSnippet
LOWpytest_locust/plugin.py7
LOWlocust/event.py1
LOWlocust/web.py1
LOWlocust/env.py1
LOWlocust/input_events.py1
LOWlocust/dispatch.py1
LOWlocust/__init__.py24
LOWlocust/__init__.py25
LOWlocust/__init__.py26
LOWlocust/__init__.py28
LOWlocust/__init__.py29
LOWlocust/__init__.py30
LOWlocust/__init__.py30
LOWlocust/__init__.py30
LOWlocust/__init__.py31
LOWlocust/__init__.py32
LOWlocust/__init__.py32
LOWlocust/__init__.py32
LOWlocust/__init__.py33
LOWlocust/__init__.py33
LOWlocust/__init__.py34
LOWlocust/__init__.py34
LOWlocust/__init__.py34
LOWlocust/__init__.py34
LOWlocust/__init__.py63
LOWlocust/__init__.py64
LOWlocust/__init__.py8
LOWlocust/debug.py1
LOWlocust/stats.py1
LOWlocust/clients.py1
LOWlocust/runners.py1
LOWlocust/shape.py1
LOWlocust/main.py1
LOWlocust/main.py37
LOWlocust/argument_parser.py1
LOWlocust/test/test_dispatch.py1
LOWlocust/test/mock_logging.py1
LOWlocust/test/test_web.py1
LOWlocust/test/test_runners.py1
LOWlocust/test/test_main.py1
LOWlocust/util/load_locustfile.py1
LOWlocust/user/task.py1
LOWlocust/user/users.py1
LOWlocust/user/__init__.py8
LOWlocust/user/__init__.py8
LOWlocust/user/__init__.py8
LOWlocust/user/__init__.py9
LOWlocust/user/__init__.py9
LOWlocust/user/inspectuser.py1
LOWlocust/user/wait_time.py7
LOWlocust/contrib/mqtt.py1
LOWlocust/contrib/fasthttp.py1
LOWlocust/contrib/fasthttp.py5
LOWlocust/contrib/csv_request_logger.py54
LOWlocust/rpc/protocol.py1
LOWlocust/rpc/__init__.py6
LOWlocust/rpc/__init__.py7
LOWdocs/_ext/llms_txt.py36
LOWexamples/test_data_management.py23
LOWexamples/web_ui_auth/custom_form.py11
Excessive Try-Catch Wrapping46 hits · 55 pts
SeverityFileLineSnippet
LOWlocust/event.py52 except Exception:
LOWlocust/event.py85 except Exception as e:
LOWlocust/web.py658 except Exception as e:
LOWlocust/input_events.py114 except Exception as e:
MEDIUMlocust/input_events.py99def input_listener_func():
LOWlocust/runners.py387 except Exception:
LOWlocust/runners.py985 except Exception as error:
LOWlocust/runners.py1081 except Exception as e:
LOWlocust/runners.py1177 except Exception:
LOWlocust/main.py239 except Exception:
LOWlocust/main.py367 except Exception as e:
LOWlocust/main.py687 except Exception:
LOWlocust/argument_parser.py124 except Exception as e:
MEDIUMlocust/argument_parser.py121def parse(self, stream):
MEDIUMlocust/test/test_web.py204def test_reset_stats(self):
MEDIUMlocust/test/test_web.py227def test_exceptions(self):
MEDIUMlocust/test/test_web.py242def test_exceptions_csv(self):
MEDIUMlocust/test/test_web.py1059def test_report_exceptions(self):
LOWlocust/test/test_web.py207 except Exception as e:
LOWlocust/test/test_web.py230 except Exception as e:
LOWlocust/test/test_web.py245 except Exception as e:
LOWlocust/test/test_web.py1062 except Exception as e:
LOWlocust/test/__init__.py14except Exception:
LOWlocust/user/task.py375 except Exception:
LOWlocust/user/task.py384 except Exception:
LOWlocust/user/task.py387 except Exception as e:
LOWlocust/user/users.py162 except Exception as e:
LOWlocust/contrib/milvus.py97 except Exception as e:
LOWlocust/contrib/milvus.py110 except Exception as e:
LOWlocust/contrib/milvus.py159 except Exception as e:
LOWlocust/contrib/milvus.py192 except Exception as e:
LOWlocust/contrib/milvus.py226 except Exception:
LOWlocust/contrib/milvus.py248 except Exception as e:
LOWlocust/contrib/milvus.py261 except Exception as e:
LOWlocust/contrib/qdrant.py46 except Exception as e:
LOWlocust/contrib/qdrant.py79 except Exception as e:
LOWlocust/contrib/qdrant.py109 except Exception as e:
LOWlocust/contrib/qdrant.py125 except Exception as e:
LOWlocust/contrib/mqtt.py381 except Exception:
LOWlocust/contrib/fasthttp.py491 except Exception as e:
LOWlocust/contrib/postgres.py23 except Exception as e:
LOWlocust/contrib/socketio.py29 except Exception as e:
LOWlocust/contrib/socketio.py47 except Exception as e:
MEDIUMlocust/rpc/zmqrpc.py72 print(f"Error resolving address: {e}")
LOWdocs/_ext/llms_txt.py201 except Exception as e:
LOWexamples/manual_stats_reporting.py32 except Exception as e:
Hallucination Indicators3 hits · 35 pts
SeverityFileLineSnippet
CRITICALlocust/test/test_runners.py374 self.user.environment.events.request.fire(
CRITICALlocust/test/test_runners.py400 self.user.environment.events.request.fire(
CRITICALlocust/user/task.py388 self.user.environment.events.user_error.fire(user_instance=self, exception=e, tb=e.__traceback__)
Deep Nesting41 hits · 34 pts
SeverityFileLineSnippet
LOWlocust/web.py121
LOWlocust/web.py213
LOWlocust/env.py270
LOWlocust/input_events.py98
LOWlocust/input_events.py67
LOWlocust/input_events.py99
LOWlocust/opentelemetry.py46
LOWlocust/opentelemetry.py91
LOWlocust/runners.py247
LOWlocust/runners.py339
LOWlocust/runners.py466
LOWlocust/runners.py874
LOWlocust/runners.py926
LOWlocust/runners.py974
LOWlocust/runners.py1015
LOWlocust/main.py148
LOWlocust/main.py256
LOWlocust/argument_parser.py121
LOWlocust/test/test_dispatch.py1775
LOWlocust/test/test_dispatch.py2148
LOWlocust/test/test_dispatch.py3623
LOWlocust/test/test_runners.py1313
LOWlocust/test/test_runners.py1838
LOWlocust/test/test_runners.py4103
LOWlocust/test/test_main.py279
LOWlocust/test/test_main.py288
LOWlocust/test/test_main.py363
LOWlocust/test/test_main.py502
LOWlocust/test/test_main.py752
LOWlocust/test/test_main.py797
LOWlocust/test/test_main.py1469
LOWlocust/util/load_locustfile.py88
LOWlocust/user/task.py144
LOWlocust/user/task.py346
LOWlocust/user/users.py297
LOWlocust/user/sequential_taskset.py17
LOWlocust/contrib/milvus.py200
LOWlocust/contrib/fasthttp.py453
LOWlocust/contrib/fasthttp.py583
LOWdocs/_ext/llms_txt.py110
LOWexamples/response_validations.py21
Self-Referential Comments7 hits · 21 pts
SeverityFileLineSnippet
MEDIUMlocust/env.py159 # Create a new RequestStats with use_response_times_cache set to False to save some memory
MEDIUMlocust/test/test_markov_taskset.py223 # Define a class with abstract=True explicitly
MEDIUMlocust/test/test_main.py847 # Define the input filename as well as the resulting filename within the temp directory
MEDIUMdocs/conf.py2# This file is execfile()d with the current directory set to its containing dir.
MEDIUMdocs/conf.py22# Define the canonical URL if you are using a custom domain on Read the Docs
MEDIUMexamples/grpc/hello_pb2_grpc.py46# This class is part of an EXPERIMENTAL API.
MEDIUMexamples/socketio/echo_server.py12# Create a Socket.IO server
Over-Commented Block12 hits · 11 pts
SeverityFileLineSnippet
LOWlocust/runners.py361 # to unexpected behaviours such as the one in the following example:
LOWlocust/test/test_dispatch.py1081 self.assertTrue(0 <= delta <= _TOLERANCE, delta)
LOWlocust/test/test_dispatch.py1101 # {
LOWdocs/conf.py1#
LOWdocs/conf.py141
LOWdocs/conf.py181
LOWexamples/open_closed_workload.py21# so if response times increase to the point where one task execution takes more than 10s,
LOWexamples/test_data_management.py1# This example shows the various ways to run things before/outside of the normal task execution flow,
LOWexamples/browse_docs_test.py41
LOWexamples/socketio/socketio_ex.py21 # resp = self.client.post("/login", json={"username": "foo", "password": "bar"})
LOWbenchmarks/dispatch.py21USER_CLASSES: list[type[User]] = []
LOW.github/workflows/tests.yml541 with:
Slop Phrases3 hits · 7 pts
SeverityFileLineSnippet
LOWlocust/contrib/oai.py11from openai import OpenAI # dont forget to install openai
MEDIUMexamples/test_data_management.py43# If you want to get something over HTTP at this time you can use `requests` directly:
MEDIUMexamples/test_data_management.py122 # If you do not want the request logged, you can replace self.client.<method> with requests.<method>
Overly Generic Function Names3 hits · 3 pts
SeverityFileLineSnippet
LOWlocust/test/test_web.py1128 def do_something(self):
LOWlocust/user/task.py398 def execute_task(self, task):
LOWlocust/user/task.py507 def execute_task(self, task):
Redundant / Tautological Comments1 hit · 2 pts
SeverityFileLineSnippet
LOWlocust/argument_parser.py204 # Check if response is valid python code
AI Slop Vocabulary1 hit · 1 pts
SeverityFileLineSnippet
MEDIUMlocust/contrib/fasthttp.py686 """Override _urlopen() in order to make it use the response_type attribute"""