Sourcery refactored main branch#1
Conversation
| if scenario.status == "failed": | ||
| scenario_error_dir = Path("logs") | ||
| scenario_error_dir.mkdir(exist_ok=True) | ||
| base_name = time.strftime("%Y-%m-%d_%H%M%S_{}".format(re.sub(r'[/\\:*?"<>#]', "", scenario.name)[:60])) | ||
| log_file_path = scenario_error_dir / "{}.txt".format(base_name) | ||
| for step in scenario.steps: | ||
| if step.status in ["failed", "undefined"]: | ||
| log_file_path.write_text( | ||
| "Scenario: {}\nStep: {} {}\nError Message: {}".format( | ||
| scenario.name, step.keyword, step.name, step.error_message | ||
| ) | ||
| ) | ||
| break | ||
| else: | ||
| log_file_path.write_text("Scenario: {}\nStep: N/A".format(scenario.name)) | ||
| if scenario.status != "failed": | ||
| return | ||
| scenario_error_dir = Path("logs") | ||
| scenario_error_dir.mkdir(exist_ok=True) | ||
| base_name = time.strftime("%Y-%m-%d_%H%M%S_{}".format(re.sub(r'[/\\:*?"<>#]', "", scenario.name)[:60])) | ||
| log_file_path = scenario_error_dir / f"{base_name}.txt" | ||
| for step in scenario.steps: | ||
| if step.status in ["failed", "undefined"]: | ||
| log_file_path.write_text( | ||
| f"Scenario: {scenario.name}\nStep: {step.keyword} {step.name}\nError Message: {step.error_message}" | ||
| ) | ||
|
|
||
| break | ||
| else: | ||
| log_file_path.write_text(f"Scenario: {scenario.name}\nStep: N/A") |
There was a problem hiding this comment.
Function after_scenario refactored with the following changes:
- Add guard clause (
last-if-guard) - Replace call to format with f-string [×3] (
use-fstring-for-formatting)
| _chrome_options.add_argument("--disable-gpu") | ||
| if window_size: | ||
| _chrome_options.add_argument("--window-size={}".format(window_size)) | ||
| _chrome_options.add_argument(f"--window-size={window_size}") |
There was a problem hiding this comment.
Function chrome_options refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| context.http_response = requests.request( | ||
| method=method, | ||
| url=context.base_url + "/v2/pet/findByStatus?status={}".format(status), | ||
| url=context.base_url + f"/v2/pet/findByStatus?status={status}", |
There was a problem hiding this comment.
Function step_impl_1 refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
| requests.request( | ||
| method=method, | ||
| url=context.base_url + "/v2/pet/{}".format(context.pet_store_object["id"]), | ||
| url=context.base_url + f'/v2/pet/{context.pet_store_object["id"]}', |
There was a problem hiding this comment.
Function step_impl_4 refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 1.74%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Branch
mainrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
mainbranch, then run:Help us improve this pull request!