repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
subtensor
github_2023
others
95
opentensor
S0AndS0
@@ -807,6 +832,42 @@ mod tests { vector.iter().map( | x | I32F32::from_num( *x ) ).collect() } + #[test]
I like the quantity of tests!... though am somewhat concerned what'll happen if an max values for `I32F32` are passed, because at first glance it seems like that may be a panic condition
subtensor
github_2023
others
77
opentensor
SaMotlagh
@@ -103,6 +103,9 @@ impl<T: Config> Pallet<T> { // --- 3. Ensure we are not exceeding the max allowed registrations per block. ensure!( Self::get_registrations_this_block( netuid ) < Self::get_max_registrations_per_block( netuid ), Error::<T>::TooManyRegistrationsThisBlock ); + // --- 4. Ensure we ...
why do you multiply target_registration by 3?
subtensor
github_2023
others
20
opentensor
SaMotlagh
@@ -347,6 +349,17 @@ pub mod pallet { pub ip_type: u8, // --- Prometheus ip type, 4 for ipv4 and 6 for ipv6. } + // Rate limiting + #[pallet::type_value] + pub fn DefaultTxRateLimit<T: Config>() -> u64 { T::InitialTxRateLimit::get() } + #[pallet::type_value] + pub fn DefaultLastTxBlock<T: Config>() -> u64 ...
hotkey?
subtensor
github_2023
others
20
opentensor
SaMotlagh
@@ -1244,7 +1259,15 @@ pub mod pallet { Self::do_sudo_set_serving_rate_limit( origin, serving_rate_limit ) } + // Sudo call for setting tx rate limit #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + pub fn sudo_set_tx_rate_limit( origin:OriginFor<T>, tx_rate_limit: u64 ) -> DispatchResult { ...
did you add weights for sudo_set_max_burn?
subtensor
github_2023
others
20
opentensor
shibshib
@@ -114,6 +114,7 @@ parameter_types! { pub const InitialDefaultTake: u16 = 11_796; // 18% honest number. pub const InitialWeightsVersionKey: u16 = 0; pub const InitialServingRateLimit: u64 = 0; // No limit. + pub const InitialTxRateLimit: u64 = 0; // No limit.
should we not set a limit right off the bat?
subtensor
github_2023
others
1,485
opentensor
JohnReedV
@@ -66,45 +67,49 @@ impl<T: Config> Pallet<T> { // will take in order for the distance between current EMA of price and current price to shorten // by half. let halving_time = EMAPriceHalvingBlocks::<T>::get(netuid); - let alpha: I96F32 = - SubnetMovingAlpha::<T>::get().satu...
> Convert batch to signed I96F32 to avoid migration of SubnetMovingPrice for now Should the migration be included in this PR?
locust-grasshopper
github_2023
python
49
alteryx
devashish2203
@@ -14,6 +16,16 @@ from locust import HttpUser +class LogLevel(Enum):
Why are we duplicating standard logging levels? The caller should be able to pass the log level from LogLevel directly I believe.
locust-grasshopper
github_2023
python
49
alteryx
devashish2203
@@ -24,6 +36,14 @@ class BaseJourney(HttpUser): base_torn_down = False defaults = {"thresholds": {}} + def log_vu(self, message: str, level: LogLevel = LogLevel.INFO, use_vu_prefix=True):
nit: Maybe call this just log or log_message. log_vu makes it seem that the function is logging only the vu number.
locust-grasshopper
github_2023
python
49
alteryx
devashish2203
@@ -38,20 +38,15 @@ def mock_journey(): def check_iteration_count(journey, count): - assert ( - journey.environment.stats.num_iterations == count - ), "Decorator did not actually increment the environment iterations count" - assert ( - journey.vu_iteration == count - ), "Decorator did not...
Why are we deleting these comments?
locust-grasshopper
github_2023
others
49
alteryx
danopolan
@@ -56,9 +56,11 @@ is called `Grasshopper.launch_test`. This function can be imported like so: `fro class. `scenario_args` also grabs from `self.defaults` on initialization. For example: ```python +import logging from locust import between, task from grasshopper.lib.journeys.base_journey import BaseJourney f...
since we have implemented `log_prefix()` function to be used for all tests which are run by VU, we should utilize it for all example tests and in the documentation.
locust-grasshopper
github_2023
python
29
alteryx
alteryx-sezell
@@ -177,3 +179,27 @@ def load_shape(shape_name: str, **kwargs) -> LoadTestShape: f"Shape {shape_name} does not exist in " f"grasshopper.lib.util.shapes! Please check the spelling." ) + + @staticmethod + def set_ulimit(): + """Increase the maximum number of ope...
Maybe we should make this value be a command line arg?
locust-grasshopper
github_2023
python
25
alteryx
alteryx-sezell
@@ -145,7 +145,7 @@ def env_var_args(env_var_prefix_key, extra_env_var_keys): or env_var_name in extra_env_var_keys ): if env_var_name.startswith(env_var_prefix_key): - env_var_name = env_var_name.lstrip(env_var_prefix_key) + env_var_name = env_var_name.r...
just out of curiosity, why change this? i assume there was some case that wasn't being handled, but I can't think of what it is.
locust-grasshopper
github_2023
python
25
alteryx
alteryx-sezell
@@ -79,17 +79,12 @@ def flush_check_to_dbs(self, check_name: str, check_passed: bool, extra_tags: di tags.update(extra_tags) fields = {"check_passed": int(check_passed)} time = datetime.utcnow() - points = [ - { - "measurement": "locust_checks", - ...
I like the idea of delegating the exact point construction to the listener, but this seems to be a 'private method'. There isn't a public one for this, i take it? Maybe we should think about submitting a pr for that to the listener code?
locust-grasshopper
github_2023
python
25
alteryx
alteryx-sezell
@@ -64,6 +73,7 @@ def reset_class_attributes(cls): is provided as a way to reset to the starting state. """ cls._incoming_test_parameters = {} + cls.tags = {} cls.defaults = {"tags": {}}
this should probably be `{"tags": cls.tags}` to follow the pattern above and make it so that you don't change it on one line but not the other
locust-grasshopper
github_2023
python
45
alteryx
skezell
@@ -67,8 +68,18 @@ def influx_configuration(self) -> dict[str, Optional[str]]: if pwd: configuration["pwd"] = pwd + configuration["ssl"] = self.to_bool(self.global_configuration.get("influx_ssl", "False"))
I have some confusion here about why you are converting the value to bool here. The way that this variable is declared indicates that it should be automatically cast to a boolean (`"typecast": typecast_bool`). This occurs via the `typecast` fixture at a point after all values have been merged from all the different pos...
locust-grasshopper
github_2023
python
45
alteryx
skezell
@@ -67,8 +68,18 @@ def influx_configuration(self) -> dict[str, Optional[str]]: if pwd: configuration["pwd"] = pwd + configuration["ssl"] = self.to_bool(self.global_configuration.get("influx_ssl", "False")) + configuration["verify_ssl"] = self.to_bool(self.global_configuration.get("...
As noted above, you don't really need this method. The `typecast_bool` method already exists and is automatically getting applied to all the variables.
locust-grasshopper
github_2023
others
45
alteryx
skezell
@@ -111,6 +111,9 @@ within that YAML file that corresponds to the scenario you wish to run. Defaults you must specify a host. E.g. `1.1.1.1`. Defaults to None. - `--influx_port`: Port for your `influx_host` in the case where it is non-default. +- `--influx_ssl`: If your influxdb is using SSL, set this to True. D...
Are these 2 different values or 2 different attributes? could one be False and one be True? Could you be using ssl, but don't want the verify ssl to be true?
locust-grasshopper
github_2023
python
42
alteryx
skezell
@@ -20,13 +20,8 @@ def custom_trend(trend_name: str, extra_tag_keys=[]): def calc_time_delta_and_report_metric(func): def wrapper(journey_object, *args, **kwargs): - tags = {} try: environment = journey_object.environment - host = environment.host ...
why are we getting rid of this line? do we not want to allow extra tags passed in this way anymore?
locust-grasshopper
github_2023
python
42
alteryx
skezell
@@ -37,20 +32,13 @@ def wrapper(journey_object, *args, **kwargs): result = func(journey_object, *args, **kwargs) end_time = datetime.now() time_delta = end_time - start_time - tags.update( - { - extra_tag_key: test_parameters.get(extra_...
is this being added in someplace else? i thought we for sure would want the host included in the tags?
locust-grasshopper
github_2023
others
35
alteryx
jmfiola
@@ -0,0 +1,5 @@ +# Database Listener for Locust/Grasshopper Design Documentation
I'm thinking we should mention this new dir in the README somewhere
locust-grasshopper
github_2023
others
36
alteryx
alteryx-sezell
@@ -13,75 +13,22 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" - - run: pip install -r requirements-dev.txt - - run: black . --check - flake8-lint: + - run: pip install -e ".[dev]" + - run: ruff check . + unit-test: if: "!contains(github.even...
yay, tox!!!!!
locust-grasshopper
github_2023
python
30
alteryx
alteryx-sezell
@@ -23,6 +23,8 @@ class GrasshopperConstants: "slack_report_failures_only", "cleanup_s3", "rp_token", + "rp_uuid", + "rp_launch",
why so we have `rp_launch` and r`p_launch_name`? is one legacy?
locust-grasshopper
github_2023
others
26
alteryx
alteryx-sezell
@@ -30,3 +30,20 @@ example_scenario_2: tags: - 'smoke' - 'example2' + +example_scenario_composite: + grasshopper_args: + users: 10 + spawn_rate: 1 + runtime: 200 + child_scenarios: + - scenario_name: example_scenario_1
which values for grasshopper_args are being used for the child scenario? those that come from the composite scenario or from the child scenario?
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -380,25 +387,51 @@ def pytest_collect_file(parent, path): class YamlScenarioFile(pytest.File): """The logic behind what to do when a Yaml file is specified in pytest.""" + composite_weighted_user_classes = {} + def collect(self): """Collect the file, knowing the path via self.fspath.""" ...
probably want to move this import to the top
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -380,25 +387,51 @@ def pytest_collect_file(parent, path): class YamlScenarioFile(pytest.File): """The logic behind what to do when a Yaml file is specified in pytest.""" + composite_weighted_user_classes = {} + def collect(self): """Collect the file, knowing the path via self.fspath.""" ...
ditto for this import
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -380,25 +387,51 @@ def pytest_collect_file(parent, path): class YamlScenarioFile(pytest.File): """The logic behind what to do when a Yaml file is specified in pytest.""" + composite_weighted_user_classes = {} + def collect(self): """Collect the file, knowing the path via self.fspath.""" ...
i would only calculate the destination once, this is the kind of thing it's easy to change in one place and not the other. also might not be a bad idea to log.debug of the file copy parameters. and lastly, i think shutil.copy2 has a way to specify what to do if the destination file already exists? i assume in this cas...
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -531,3 +564,87 @@ def type_check_list_of_strs(list_of_strs): all_strs = all_strs and type(s) == str check_passed = all_strs return check_passed + + +def _get_composite_weighted_user_classes( + full_scenarios_list, composite_scenario_contents +): + """Generate a dictionary of journey ...
i think we either want to use os.path.join or the new file path object, which I'm blanking on the name of, here rather than calculating string directly.
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -531,3 +564,87 @@ def type_check_list_of_strs(list_of_strs): all_strs = all_strs and type(s) == str check_passed = all_strs return check_passed + + +def _get_composite_weighted_user_classes( + full_scenarios_list, composite_scenario_contents +): + """Generate a dictionary of journey ...
i feel like we might want some debug logging statements through this chunk of code because if it doesn't work, it's all ephemeral and it will be hard to figure out what is going on. also, for the same reason we might want the generation of the new class in a try/catch block
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -531,3 +564,87 @@ def type_check_list_of_strs(list_of_strs): all_strs = all_strs and type(s) == str check_passed = all_strs return check_passed + + +def _get_composite_weighted_user_classes( + full_scenarios_list, composite_scenario_contents +): + """Generate a dictionary of journey ...
use logging rather than print
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -531,3 +564,87 @@ def type_check_list_of_strs(list_of_strs): all_strs = all_strs and type(s) == str check_passed = all_strs return check_passed + + +def _get_composite_weighted_user_classes( + full_scenarios_list, composite_scenario_contents +): + """Generate a dictionary of journey ...
this feels teeny bit confusing that you raise an error and then catch the error and do something. why not just return `None` here?
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -531,3 +564,87 @@ def type_check_list_of_strs(list_of_strs): all_strs = all_strs and type(s) == str check_passed = all_strs return check_passed + + +def _get_composite_weighted_user_classes( + full_scenarios_list, composite_scenario_contents +): + """Generate a dictionary of journey ...
is there any logic to prevent the user from listed a composite scenario as a child scenario? or does that work? i think it probably does not, given how we've designed this.
locust-grasshopper
github_2023
python
26
alteryx
alteryx-sezell
@@ -0,0 +1,24 @@ +"""Module: BaseJourney.
this needs to be updated ;)
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -177,6 +177,16 @@ class ConfigurationConstants: "default": 120.0, "typecast": typecast_float, }, + "stop_timeout": {
nit: this name is confusing, it's a graceful shutdown time, correct? can you try a name along those lines?
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -196,3 +197,52 @@ def __init__(self, *args, **kwargs): }, ] super().__init__(*args, **kwargs) + +class Customstages(Default): # noqa E501 + """ + Stolen from this set of examples as part of the locust.io documentation. + https://github.com/locustio/locust/blob/master/examples...
this class takes a keyword argument `stages` that is a json string with this structure. it's important to note that.
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -196,3 +197,52 @@ def __init__(self, *args, **kwargs): }, ] super().__init__(*args, **kwargs) + +class Customstages(Default): # noqa E501 + """ + Stolen from this set of examples as part of the locust.io documentation. + https://github.com/locustio/locust/blob/master/examples...
you can feel free to have the default for this class be much simpler if you want, the default on the original was only there to provide an example
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -196,3 +197,52 @@ def __init__(self, *args, **kwargs): }, ] super().__init__(*args, **kwargs) + +class Customstages(Default): # noqa E501 + """ + Stolen from this set of examples as part of the locust.io documentation. + https://github.com/locustio/locust/blob/master/examples...
you don't need this method. you are inheriting from `Stages` which has the exact same implementation. that is, in fact, the primary reason to inherit from that class.
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -196,3 +197,52 @@ def __init__(self, *args, **kwargs): }, ] super().__init__(*args, **kwargs) + +class Customstages(Default): # noqa E501 + """ + Stolen from this set of examples as part of the locust.io documentation.
nit: you don't really need this comment, it is relevant to the `Stages` class
locust-grasshopper
github_2023
python
23
alteryx
alteryx-sezell
@@ -46,6 +46,7 @@ def current_global_defaults(): "shape": "Default", "users": 1.0, "runtime": 120.0, + "stop_timeout": 300.0,
5 minutes for a graceful shutdown of users seems very long? at least for a default value. i can't seem to find where this value is being used for anything? where is the code for that?
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -477,7 +477,10 @@ def _fetch_args(attr_names, config) -> dict: def _get_tagged_scenarios(raw_yaml_dict, config, fspath) -> dict: valid_scenarios = {} - if config.getoption("--tags"): + tags_to_query_for = ( + config.getoption("--tags") or os.getenv("TAGS") or os.getenv("tags")
we don't support using the lower case name in the env vars for any other parameter, so we could skip supporting it here. your call.
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -0,0 +1,40 @@ +import os +from unittest.mock import MagicMock + +from grasshopper.lib.fixtures import _get_tagged_scenarios + + +def test_get_tagged_scenarios_happy(): + config_mock = MagicMock() + config_mock.getoption = lambda a: "asdf" + raw_yaml_dict = { + "scenario1": {"tags": ["asdf"]}, + ...
would be better to use `patch.dict` to alter the contents of `os.environ` since that will act as a context manager and ensure that there aren't side effects caused by this test or side effects from other tests with this one. in fact, if for some reason this test ran before the first one, the first one in the file would...
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -0,0 +1,40 @@ +import os +from unittest.mock import MagicMock + +from grasshopper.lib.fixtures import _get_tagged_scenarios + + +def test_get_tagged_scenarios_happy():
ideally, we'd also use the `caplog` fixture here and check that the correct message was output. there is some code for validating specific messages (`was_message_logged`) in the `unit/conftest.py` probably there are other tests in this set where that would be appropriate as well.
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -0,0 +1,40 @@ +import os +from unittest.mock import MagicMock + +from grasshopper.lib.fixtures import _get_tagged_scenarios + + +def test_get_tagged_scenarios_happy(): + config_mock = MagicMock() + config_mock.getoption = lambda a: "asdf" + raw_yaml_dict = { + "scenario1": {"tags": ["asdf"]}, + ...
see my comment above about using patch.dict. you can patch a dict to be completely empty by doing passing just `clear=True`
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -0,0 +1,40 @@ +import os +from unittest.mock import MagicMock + +from grasshopper.lib.fixtures import _get_tagged_scenarios + + +def test_get_tagged_scenarios_happy(): + config_mock = MagicMock() + config_mock.getoption = lambda a: "asdf" + raw_yaml_dict = { + "scenario1": {"tags": ["asdf"]}, + ...
see comment above about caplog to check for the warning message this will output
locust-grasshopper
github_2023
python
20
alteryx
alteryx-sezell
@@ -0,0 +1,40 @@ +import os
awesome that you added unit tests for this method!
locust-grasshopper
github_2023
others
15
alteryx
alteryx-sezell
@@ -16,7 +16,125 @@ Here are some key functionalities that this project extends on Locust: ## Installation This package can be installed via pip: `pip install locust-grasshopper` +## Example Load Test +- You can refer to the test `test_example.py` in the `example` directory for a basic + skeleton of how to get a ...
might make this into a multiline code block, for readability
locust-grasshopper
github_2023
others
15
alteryx
alteryx-sezell
@@ -16,7 +16,125 @@ Here are some key functionalities that this project extends on Locust: ## Installation This package can be installed via pip: `pip install locust-grasshopper` +## Example Load Test +- You can refer to the test `test_example.py` in the `example` directory for a basic + skeleton of how to get a ...
technically, this can be a dict (key=class, value=weight), but maybe we don't want to add that complexity here?
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
i think maybe it might be a good idea to make the .9 a constant
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
is it possible for there to be more tags coming from a second threshold?
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
i think we've mostly been using warning level for things that we are skipping because of invalid input
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
probably this is too restrictive. really we could get passed any kind of dict-like object and that would be sufficient. following the python philosophy of duck typing, we don't want to unnecessarily restrict. i might suggest `not isinstance(thresholds_shape,collections.Mapping)`
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
slightly confused by the name here. it's not the 'shape' of the thresholds collection, it is the thresholds collection, right?
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
For this one, we could always just do `str(trend_name)`. We don't really care what they call it, as long as we have a string name to use as the key.
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
for all of these messages, 1. I think warning is more appropriate and 2. do we want something in the message about we are ignoring only this thresholds collection, meaning for this journey?
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds":
I think you should take out this if and then modify line 106. There is no reason to loop through the entire collection just in order to see there is an entry for thresholds in the dict. you can replace with ``` thresholds = self.scenario_args.get("thresholds") if thresholds: self._check_for_threshold_parameter...
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
I'm wondering if the first time we hit a problem, we should just return and skip the rest of the checks? this will give you a fuller report on the expected shape, but we also document that elsewhere, right?
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -112,37 +113,73 @@ def _check_for_threshold_parameters_and_set_thresholds( self, parameter_key, parameter_value ): if parameter_key == "thresholds": - for raw_trend_name, threshold_less_than_in_ms in parameter_value.items(): - trend_name, request_type = self._extract_...
wondering if we should try a typecast to fixup if the user passes the value as "1" instead of 1? then if it's still not numeric, then return false? not required to handle this case, of course, but would likely fix up a good percentage of the problems with this particular key-value pair.
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -39,40 +39,70 @@ def test_set_test_parameters(): def test_set_test_parameters_with_thresholds_and_tags(): BaseJourney.replace_incoming_scenario_args( { - "thresholds": {"{POST}asdf": "1", "{GET}asdf": "2"}, + "thresholds": { + "asdf1": {"type": "get", "limit": 1}, ...
would be good to also check that errors (or warnings if you change that) got logged. pytest provides a fixture called `caplog` for this purpose. you include caplog in your signature, then you put your test call into a context manager like so ``` with caplog.at_level(logging.DEBUG): <do the test call> ``` yo...
locust-grasshopper
github_2023
python
15
alteryx
alteryx-sezell
@@ -39,40 +39,70 @@ def test_set_test_parameters(): def test_set_test_parameters_with_thresholds_and_tags(): BaseJourney.replace_incoming_scenario_args( { - "thresholds": {"{POST}asdf": "1", "{GET}asdf": "2"}, + "thresholds": { + "asdf1": {"type": "get", "limit": 1}, ...
is this the right test name?
locust-grasshopper
github_2023
others
15
alteryx
alteryx-sezell
@@ -324,15 +330,26 @@ def test_run_example_journey(complete_configuration): ExampleJourney.update_incoming_scenario_args(complete_configuration) ExampleJourney.update_incoming_scenario_args({ "thresholds": { - "{GET}get google": 4000, # 4 second HTTP response threshold - "{CUSTO...
I had been thinking that we would not need to include 'get' in the name anymore, since the type is stored elsewhere. but it is still true that you can name it anything you want, so... not sure if it matters.
locust-grasshopper
github_2023
others
15
alteryx
alteryx-sezell
@@ -324,15 +330,26 @@ def test_run_example_journey(complete_configuration): ExampleJourney.update_incoming_scenario_args(complete_configuration) ExampleJourney.update_incoming_scenario_args({ "thresholds": { - "{GET}get google": 4000, # 4 second HTTP response threshold - "{CUSTO...
did you also want to mention setting thresholds in the defaults on a journey class as well?
locust-grasshopper
github_2023
others
14
alteryx
jmfiola
@@ -0,0 +1,10 @@ +[settings]
This file is not needed anymore. The isort config is now being defined in the pyproject.TOML!
locust-grasshopper
github_2023
python
14
alteryx
jmfiola
@@ -476,3 +512,14 @@ def fetch_value_from_multiple_sources(sources, key): for source in sources: value = value or source.get(key) return value + + +def type_check_list_of_strs(list_of_strs): + """Return True if list of strings or [], false if anything else.""" + check_passed = False + if typ...
if `list_of_strs = []`, I think this will return False, even though the docstring says otherwise
locust-grasshopper
github_2023
python
14
alteryx
jmfiola
@@ -0,0 +1,161 @@ +from unittest.mock import patch + +from tests.unit.conftest import ( + CONFTEST_TEMPLATE, + PYFILE_ASSERT_EMPTY_CONFIG, + PYFILE_ASSERT_EXPECTED_CONFIG, + PYFILE_TEMPLATE, + perform_fixture_test_with_optional_log_capture, +) + +from grasshopper.lib.configuration.gh_configuration import...
This is a really cool pattern, is this something you discovered while at pycon? I am interested to learn more about it.
locust-grasshopper
github_2023
python
14
alteryx
jmfiola
@@ -0,0 +1,161 @@ +from unittest.mock import patch + +from tests.unit.conftest import ( + CONFTEST_TEMPLATE, + PYFILE_ASSERT_EMPTY_CONFIG, + PYFILE_ASSERT_EXPECTED_CONFIG, + PYFILE_TEMPLATE, + perform_fixture_test_with_optional_log_capture, +) + +from grasshopper.lib.configuration.gh_configuration import...
what is this `@patch.dict` doing?
RepoRater
github_2023
javascript
126
EddieHubCommunity
coderabbitai[bot]
@@ -83,6 +83,7 @@ export default function Form({ name = "", owner = "" }) { value={owner && name && `https://github.com/${owner}/${name}`} placeholder="URL" className="block w-full rounded-md border-0 bg-white/5 py-1.5 text-white shadow-sm ring-1 ring-inset ring-white/...
> :memo: **NOTE** > This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [13-35] The `save` function encapsulates the logic for form submission, including session validation, JWT creation, and the POST request to the `/api/rate` endpoint. It's crucial to handle errors graceful...
RepoRater
github_2023
javascript
129
EddieHubCommunity
coderabbitai[bot]
@@ -8,7 +8,7 @@ export const metadata = { title: "User Rankings - RepoRater" }; -export default function Page() { +export default function Page({ searchParams }) {
Ensure `searchParams` prop is validated or documented to clarify expected structure, especially the `keyword` property. <!-- This is an auto-generated comment by CodeRabbit -->
RepoRater
github_2023
javascript
129
EddieHubCommunity
coderabbitai[bot]
@@ -19,11 +19,14 @@ const badges = { caution: "text-rose-400 bg-rose-400/10 ring-rose-400/20", }; -export default async function Users() { +export default async function Users({ keyword = "" }) { + const query = keyword + ? [Query.limit(1000), Query.search("username", keyword)] + : [Query.limit(1000)];
Correctly implements keyword-based filtering with a default parameter and conditional query construction. Ensure `keyword` is sanitized before use in queries to prevent injection attacks. <!-- This is an auto-generated comment by CodeRabbit -->
RepoRater
github_2023
javascript
129
EddieHubCommunity
coderabbitai[bot]
@@ -55,6 +63,23 @@ export default function SideNav({ setKeyword, children }) { getAppwriteUser(); }, []); + useDebounce( + () => { + setDebouncedSearchKeyword(searchKeyword); + setKeyword(searchKeyword); + }, + 200, + [searchKeyword], + );
Correctly implements debouncing for the search input. Ensure the debounce interval of 200ms aligns with UX expectations and performance considerations. <!-- This is an auto-generated comment by CodeRabbit -->
RepoRater
github_2023
javascript
129
EddieHubCommunity
Vijaykv5
@@ -55,6 +63,23 @@ export default function SideNav({ setKeyword, children }) { getAppwriteUser(); }, []); + useDebounce( + () => { + setDebouncedSearchKeyword(searchKeyword); + setKeyword(searchKeyword); + }, + 200, + [searchKeyword], + ); + + useEffect(() => { + if (!debouncedSear...
Is `pathName` really needed in dependency array elements
RepoRater
github_2023
others
119
EddieHubCommunity
eddiejaoude
@@ -0,0 +1,22 @@ +name: Repo Rater Action +run-name: repo-rater (#${{ github.event.issue.number || github.event.pull_request.number }}) + +permissions: + issues: write + pull-requests: write + +on: + issues: + types: [closed] + pull_request: + types: [closed] + +jobs: + repo-rater: + runs-on: ubuntu-lates...
```suggestion pr-message: "Thank you all for contributing to RepoRater! Please take a moment to rate this repo's DX on [EddieHub's RepoRater](https://repo-rater.eddiehub.io/rate?owner=${{ github.repository_owner }}&name=${{ github.event.repository.name }}) and give the repo a star ⭐" ```
RepoRater
github_2023
others
83
EddieHubCommunity
eddiejaoude
@@ -252,4 +244,4 @@ GET https://repo-rater.eddiehub.org/api/stats ## Community -Come and chat with the community in the EddieHub Discord http://discord.eddiehub.org +Come and chat with the community in the EddieHub Discord https://discord.eddiehub.org
This needs to be http ```suggestion Come and chat with the community in the EddieHub Discord http://discord.eddiehub.org ```
RepoRater
github_2023
javascript
118
EddieHubCommunity
coderabbitai[bot]
@@ -4,6 +4,10 @@ import Users from "@/components/Users"; export const dynamic = "force-dynamic"; +export const metadata = { + title: "User Rankings -RepoRater" +};
There appears to be a typo in the title property of the `metadata` constant; there should be a space before "RepoRater". ```diff - title: "User Rankings -RepoRater" + title: "User Rankings - RepoRater" ``` <!-- This is an auto-generated comment by CodeRabbit --> --- <!-- suggestion_start --> <details> <summary>Co...
RepoRater
github_2023
javascript
118
EddieHubCommunity
ArvindParekh
@@ -0,0 +1,7 @@ +import Page from "./page"; + +export const metadata = { + title: "Popular Repos -RepoRater",
Maybe something like this would be more descriptive? ```suggestion title: "Popular Repositories - RepoRater", ``` or ```suggestion title: "Popular Repositories on RepoRater", ```
RepoRater
github_2023
javascript
118
EddieHubCommunity
eddiejaoude
@@ -0,0 +1,7 @@ +import Page from "./page"; + +export const metadata = { + title: "Popular Repositories - RepoRater", +}; + +export default Page;
This needs a blank line at the end, as indicted by GitHub with the red icon ```suggestion export default Page; ```
RepoRater
github_2023
javascript
118
EddieHubCommunity
eddiejaoude
@@ -0,0 +1,7 @@ +import Page from "./page"; + +export const metadata = { + title: "Popular Repositories - RepoRater",
The indentation is not matching other changes and also the project settings, please check you have Prettier plugin installed
RepoRater
github_2023
javascript
115
EddieHubCommunity
coderabbitai[bot]
@@ -77,37 +87,40 @@ export default function SideNav({ setKeyword, children }) { getAppwriteUser(); }, []); - const secure = [ - { - id: 1, - name: "Add Rating", - href: "/rate", - initial: "+", - current: false, - }, - // { - // id: 2, - // name: "Your Ratings", - ...
The commented-out sections within the `secure` array (lines 99-112) should be removed if they are no longer needed to keep the codebase clean and maintainable. ```diff - // { - // id: 2, - // name: "Your Ratings", - // href: "/account/ratings", - // initial: "S", - // current: pathName === "/account/ratings"...
RepoRater
github_2023
javascript
115
EddieHubCommunity
eddiejaoude
@@ -18,34 +18,44 @@ import Logo from "@/assets/repo-rater-logo.svg"; import GitHub from "@/assets/github-mark.svg"; import { account } from "@/config/appwrite-client"; import getUser from "@/utils/github/getUser"; - -const navigation = [ - { name: "GitHub Repos", href: "/", icon: FolderIcon, current: false }, - { ...
This seems like a duplicate πŸ€” Can the data be kept outside the function as before and have the calculation in the function?
RepoRater
github_2023
javascript
115
EddieHubCommunity
coderabbitai[bot]
@@ -83,21 +97,21 @@ export default function SideNav({ setKeyword, children }) { name: "Add Rating", href: "/rate", initial: "+", - current: false, + current: pathName === "/rate", }, // { // id: 2, // name: "Your Ratings", // href: "/account/ratings", /...
It appears that there are commented-out sections for "Your Ratings" and "Your Repos" in the `secure` array. If these features are not intended to be part of the current release, it's good practice to remove commented-out code to keep the codebase clean. If they are a work in progress, it might be better to track them i...
RepoRater
github_2023
javascript
115
EddieHubCommunity
eddiejaoude
@@ -83,21 +97,21 @@ export default function SideNav({ setKeyword, children }) { name: "Add Rating", href: "/rate", initial: "+", - current: false, + current: pathName === "/rate",
Looking good, are these still needed, because the check is done on line `60` with `href`?
RepoRater
github_2023
javascript
110
EddieHubCommunity
coderabbitai[bot]
@@ -75,63 +68,7 @@ export default function Repos({ minimumVotes = 5, keyword, sort }) { return ( <ul role="list" className="divide-y divide-white/5"> {repos.map((repo, idx) => ( - <li - key={idx} - className="relative flex items-center space-x-4 px-4 py-4 sm:px-6 lg:px-8" - ...
The `RepoList` component is used within a map function to render the list of repositories. The `key` prop is set to the index of the map, which is not recommended in React when the list can change. If the repositories have unique identifiers, it would be better to use those as keys to help React identify which items ha...
RepoRater
github_2023
javascript
110
EddieHubCommunity
coderabbitai[bot]
@@ -0,0 +1,79 @@ +import Image from "next/image"; +import Link from "next/link"; +import React from "react"; +import { ChevronRightIcon } from "@heroicons/react/20/solid"; +import { classNames } from "@/utils/classNames"; + +const statuses = { + research: "text-orange-500 bg-orange-100/10", + recommend: "text-green-4...
The `statuses` and `badges` objects are defined but not used within the `RepoList` component. If these objects are no longer needed, they should be removed to keep the code clean and maintainable. ```diff - const statuses = { - research: "text-orange-500 bg-orange-100/10", - recommend: "text-green-400 bg-green-400...
RepoRater
github_2023
javascript
90
EddieHubCommunity
coderabbitai[bot]
@@ -0,0 +1,43 @@ +import Image from "next/image"; +import Link from "next/link"; + +const ActivityList = ({ rating }) => { + return ( + <> + <li className="px-4 py-4 sm:px-6 lg:px-8"> + <div className="flex items-center gap-x-3"> + <Link href={`https://github.com/${rating.username}`} target="_blank">
The `target="_blank"` attribute is used without `rel="noopener noreferrer"`. For security reasons, consider adding `rel="noopener noreferrer"` to any link opening in a new tab. ```diff - <Link href={`https://github.com/${rating.username}`} target="_blank"> + <Link href={`https://github.com/${rating.username}`} target="...
RepoRater
github_2023
javascript
90
EddieHubCommunity
coderabbitai[bot]
@@ -1,61 +1,52 @@ "use client"; import { useEffect, useState } from "react"; +import dynamic from "next/dynamic"; import { client } from "@/config/appwrite-client"; -import { abbreviateNumber } from "@/utils/abbreviateNumbers"; +import StatSkeleton from "./ListSkeletons/StatSkeleton"; + +const StatsList = dynami...
Consider refactoring the inline calculation for 'Recommended Repos' percentage into a separate function for better readability and maintainability. ```diff - value: ((data.stars / data.ratings / 5) * 100).toFixed(1), + value: calculateRecommendedReposPercentage(data.stars, data.ratings).toFixed(1), // Outside of the c...
RepoRater
github_2023
javascript
90
EddieHubCommunity
eddiejaoude
@@ -1,18 +1,18 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: [ - "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", - "./src/components/**/*.{js,ts,jsx,tsx,mdx}", - "./src/app/**/*.{js,ts,jsx,tsx,mdx}", - ], - theme: { - extend: { - backgroundImage: { - "gradient-radial"...
I think these indentations are not required?
RepoRater
github_2023
javascript
90
EddieHubCommunity
coderabbitai[bot]
@@ -6,56 +6,56 @@ import { client } from "@/config/appwrite-client"; import { abbreviateNumber } from "@/utils/abbreviateNumbers"; export default function Stats() { - const [stats, setStats] = useState([]); + const [stats, setStats] = useState([]); - const getStats = async () => { - const res = await fetch("...
The inline calculation for 'Recommended Repos' percentage is complex and affects readability. As previously suggested, consider refactoring this into a separate function. ```diff - value: ((data.stars / data.ratings / 5) * 100).toFixed(1), + value: calculateRecommendedReposPercentage(data.stars, data.ratings).toFixed(1...
RepoRater
github_2023
javascript
90
EddieHubCommunity
coderabbitai[bot]
@@ -6,56 +6,56 @@ import { client } from "@/config/appwrite-client"; import { abbreviateNumber } from "@/utils/abbreviateNumbers"; export default function Stats() { - const [stats, setStats] = useState([]); + const [stats, setStats] = useState([]); - const getStats = async () => { - const res = await fetch("...
The content of `Stats.js` shows the `useEffect` hook used for subscribing to Appwrite events. However, there is no cleanup function provided within this hook to unsubscribe from the events when the component unmounts. This aligns with the review comment that pointed out the potential for memory leaks due to missing uns...
RepoRater
github_2023
javascript
95
EddieHubCommunity
coderabbitai[bot]
@@ -1,6 +1,6 @@ import { classNames } from "@/utils/classNames"; -export default function Toast({ type = "info", message }) { +export default function Toast({ type = "info", message, repo }) {
The `Toast` function now accepts a new parameter `repo`. It's recommended to document this parameter and ensure it is type-checked for better maintainability and to prevent potential bugs. <!-- This is an auto-generated reply by CodeRabbit -->
RepoRater
github_2023
javascript
95
EddieHubCommunity
eddiejaoude
@@ -35,7 +35,9 @@ export default function Form({ name = "", owner = "" }) { if (data.success) { setSending(false); - redirect("/?alert=success&message=Rating saved!"); + redirect( + `/?alert=success&message=Rating%20saved!%20for%20${owner}/${name}%20πŸŽ‰πŸŽ‰`
I don't think it needs url encoding? It makes it more difficult to read in the code - please test without encoding
RepoRater
github_2023
javascript
95
EddieHubCommunity
eddiejaoude
@@ -11,7 +11,10 @@ export default function Toast({ type = "info", message }) { type === "error" && "alert-error", ])} > - <span>{message}</span> + <span className="font-bold"> + {message.slice(0, 18)} + <span className="text-white ">{message.slice(18)}</span> +...
This will not work for any other message - further improvements to this can come later, let's get it merged sooner before adding more changes
RepoRater
github_2023
javascript
95
EddieHubCommunity
eddiejaoude
@@ -35,7 +35,9 @@ export default function Form({ name = "", owner = "" }) { if (data.success) { setSending(false); - redirect("/?alert=success&message=Rating saved!"); + redirect( + `/?alert=success&message=Rating saved! for ${owner}/${name} πŸŽ‰πŸŽ‰`
```suggestion `/?alert=success&message=Rating saved for ${owner}/${name} πŸŽ‰` ```
RepoRater
github_2023
javascript
102
EddieHubCommunity
coderabbitai[bot]
@@ -17,7 +17,7 @@ export default function Form({ name = "", owner = "" }) { jwt = await account.createJWT(); } catch (e) { console.error(e); - return redirect("/"); + return redirect("/?alert=error&message=Invalid Session"); } const res = await fetch("/api/rate", { method: ...
> Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [20-33] The POST request to `/api/rate` should be wrapped in a try-catch block to handle any potential errors that could occur during the network call. This would allow for a more graceful handling of e...
RepoRater
github_2023
javascript
103
EddieHubCommunity
coderabbitai[bot]
@@ -51,7 +51,7 @@ export default function SideNav({ setKeyword, children }) { account.createOAuth2Session( "github", `${process.env.NEXT_PUBLIC_BASE_URL}/`, - `${process.env.NEXT_PUBLIC_BASE_URL}/` + `${process.env.NEXT_PUBLIC_BASE_URL}/`, );
There appears to be a duplicated line of code here. Please confirm if this is intentional or if one of the lines should be removed to avoid potential confusion or errors. ```diff - `${process.env.NEXT_PUBLIC_BASE_URL}/`, - `${process.env.NEXT_PUBLIC_BASE_URL}/`, + `${process.env.NEXT_PUBLIC_BASE_URL}/` `...
RepoRater
github_2023
javascript
103
EddieHubCommunity
eddiejaoude
@@ -51,7 +51,7 @@ export default function SideNav({ setKeyword, children }) { account.createOAuth2Session( "github", `${process.env.NEXT_PUBLIC_BASE_URL}/`, - `${process.env.NEXT_PUBLIC_BASE_URL}/` + `${process.env.NEXT_PUBLIC_BASE_URL}/`,
This is not an array or object, so I will remove ```suggestion `${process.env.NEXT_PUBLIC_BASE_URL}/` ```
RepoRater
github_2023
javascript
101
EddieHubCommunity
coderabbitai[bot]
@@ -22,7 +22,7 @@ export async function POST(request) { const gitHubUserData = await getUser(session.providerAccessToken); username = gitHubUserData.login; } catch (e) { - return redirect("/auth/login"); + return redirect("/?alert=error&message=Invalid Session"); } console.info(`User ${username...
Based on the extended output, it seems that while there is error handling for the `getUser` async call, other async calls such as `getRepo` and `new sdk.Databases(clientAdmin()).listDocuments` do not have try-catch blocks around them. This could result in unhandled exceptions if these operations fail. Therefore, the ...
RepoRater
github_2023
javascript
89
EddieHubCommunity
coderabbitai[bot]
@@ -1,22 +1,35 @@ "use client"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Bars3Icon, MagnifyingGlassIcon } from "@heroicons/react/20/solid"; import SideNav from "@/components/SideNav"; import Repos from "@/components/Repos"; import Activity from "@/components/Act...
The `useEffect` hook is used to manage the lifecycle of the alert. It correctly depends on the `alert` variable, showing the alert when `alert` is true and setting a timeout to hide it after 4 seconds. However, the comment on line 28 is incomplete and should be finished for clarity. ```diff - // remove alert be + // r...
RepoRater
github_2023
javascript
89
EddieHubCommunity
coderabbitai[bot]
@@ -1,22 +1,35 @@ "use client"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Bars3Icon, MagnifyingGlassIcon } from "@heroicons/react/20/solid"; import SideNav from "@/components/SideNav"; import Repos from "@/components/Repos"; import Activity from "@/components/Act...
The `router.push` method is used to navigate without a page refresh. The `scroll: false` option is correctly used to prevent scrolling to the top of the page. However, the hardcoded message "Rating saved!" should be replaced with the `message` variable to ensure dynamic message content. ```diff - router.push(`/?done=s...
RepoRater
github_2023
javascript
89
EddieHubCommunity
eddiejaoude
@@ -1,16 +1,14 @@ "use client"; +import { useEffect, useState } from "react"; import { Fragment, useState } from "react"; import SideNav from "@/components/SideNav"; import Repos from "@/components/Repos"; import Activity from "@/components/Activity"; import Stats from "@/components/Stats"; import Toast from...
Not sure why these are removed? The page will break, please test
RepoRater
github_2023
javascript
89
EddieHubCommunity
eddiejaoude
@@ -21,10 +21,23 @@ const sortOptions = [ export default function Page() { const params = useSearchParams(); + const router = useRouter(); const alert = params.get("alert"); const message = params.get("message"); const [keyword, setKeyword] = useState(""); const [sort, setSort] = useState(sortOptions...
As mentioned in a previous inline comment, I think this should be `/`?
RepoRater
github_2023
javascript
89
EddieHubCommunity
eddiejaoude
@@ -21,10 +21,23 @@ const sortOptions = [ export default function Page() { const params = useSearchParams(); + const router = useRouter(); const alert = params.get("alert"); const message = params.get("message"); const [keyword, setKeyword] = useState(""); const [sort, setSort] = useState(sortOptions...
With the new changes of the redirect not having the params, this is no longer required ```suggestion ```
RepoRater
github_2023
javascript
89
EddieHubCommunity
eddiejaoude
@@ -21,10 +21,23 @@ const sortOptions = [ export default function Page() { const params = useSearchParams(); + const router = useRouter(); const alert = params.get("alert"); const message = params.get("message"); const [keyword, setKeyword] = useState(""); const [sort, setSort] = useState(sortOptions...
This is now also no longer needed ```suggestion ```