-
-
Notifications
You must be signed in to change notification settings - Fork 46
fix-ruff-lock #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix-ruff-lock #460
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request removes code formatting and import-sorting steps from the Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pyproject.toml (1)
80-82: Test Paths VerificationThe
testpathsoption currently specifies only the"tests"directory. Verify that this configuration correctly captures all necessary test files. If additional test directories exist or might be introduced in the future, consider updating this list.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
.github/workflows/devRun.yml(0 hunks)pyproject.toml(2 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/devRun.yml
🔇 Additional comments (2)
pyproject.toml (2)
39-43: Dependency Group Update: Transition to RuffThe dev dependency group now includes
ruff==0.11.4andpre-commit==4.2.0, effectively replacing the previousblackandisortdependencies. This change aligns with the project’s migration to using Ruff for linting and formatting. Please ensure that any related documentation and CI workflow references (such as in.github/workflows/devRun.yml) have been updated accordingly.
45-54: Ruff Configuration: Comprehensive SetupThe new
[tool.ruff]configuration sets aline-lengthof 100, targets Python 3.11, and applies all linting rules viaselect = ["ALL"], while intentionally ignoring rulesD203andD213to suit your docstring formatting preferences. Confirm that these ignored rules align with your team’s style guidelines and that this configuration meets your overall linting requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (15)
pages/templates_page.py (2)
13-14: Enhance constructor signature with type annotations and docstring.
The__init__method currently lacks type annotations for its parameters (driverandwait), a return type annotation (None), and a docstring. Adding these will both satisfy linter requirements (e.g., ANN001, ANN204, D107) and improve code clarity.
Example diff suggestion:-def __init__(self, driver, wait): - super().__init__(driver, wait) +def __init__(self, driver: WebDriver, wait: WebDriverWait) -> None: + """ + Initialize the TemplatesPage with a Selenium WebDriver and a wait object. + """ + super().__init__(driver, wait)(Ensure to import
WebDriverandWebDriverWaitfrom selenium as needed.)🧰 Tools
🪛 Ruff (0.8.2)
13-13: Missing return type annotation for special method
__init__Add return type annotation:
None(ANN204)
13-13: Missing docstring in
__init__(D107)
13-13: Missing type annotation for function argument
driver(ANN001)
13-13: Missing type annotation for function argument
wait(ANN001)
16-16: Add a docstring to the public methodchoose_template.
Providing a brief description for this method will clarify its purpose for other developers and satisfy linter warning (D102).
Example:-def choose_template(self, template_name: str) -> None: +def choose_template(self, template_name: str) -> None: + """ + Select the template that contains the given template name. + """🧰 Tools
🪛 Ruff (0.8.2)
16-16: Missing docstring in public method
(D102)
pages/projects_page.py (3)
149-149: Document the purpose ofget_workspaces_number.
This public method currently lacks a docstring. Consider adding one to describe its functionality (i.e., returning the count of workspace elements found).
Example diff:-def get_workspaces_number(self) -> int: +def get_workspaces_number(self) -> int: + """ + Retrieve the number of workspaces displayed. + """🧰 Tools
🪛 Ruff (0.8.2)
149-149: Missing docstring in public method
(D102)
166-166: Include documentation forget_projects_number_from_workspace.
Adding a docstring here will improve clarity and satisfy linter hint (D102).
Example:-def get_projects_number_from_workspace(self) -> int: +def get_projects_number_from_workspace(self) -> int: + """ + Get the number of projects displayed next to the main workspace name. + """🧰 Tools
🪛 Ruff (0.8.2)
166-166: Missing docstring in public method
(D102)
174-174: Add a docstring foris_workspace_found.
A brief description of this method’s behavior would be beneficial.
Example:-def is_workspace_found(self, workspace_name: str) -> bool: +def is_workspace_found(self, workspace_name: str) -> bool: + """ + Check if a workspace with the given name exists. + """🧰 Tools
🪛 Ruff (0.8.2)
174-174: Missing docstring in public method
(D102)
tests/dependency_class_test.py (1)
13-17: Add return type annotation and fix line length.Consider addressing the static analysis issues:
- def test_e(self): + def test_e(self) -> None:And split the long line to meet the line length limit:
- """Placeholder test function with the dependency name "e" and depends on "TestDependencyExample::b". + """Placeholder test function with the dependency name "e" and depends on + "TestDependencyExample::b".🧰 Tools
🪛 Ruff (0.8.2)
13-13: Missing return type annotation for public function
test_eAdd return type annotation:
None(ANN201)
14-14: Line too long (108 > 100)
(E501)
utilities/web_driver_listener.py (1)
10-21: Consider adding docstrings to public methods.The static analyzer detected missing docstrings in the public methods. While not critical, adding them would improve code documentation.
def after_find(self, by: By, value: str, driver: Chrome | Firefox | Edge) -> None: + """Highlight found elements with a red border. + + :param by: The locator strategy + :param value: The locator value + :param driver: The WebDriver instance + """ webelements: list[WebElement] = driver.find_elements(by=by, value=value) for element in webelements: if element.is_displayed(): driver.execute_script( "arguments[0].setAttribute('style', 'border: 2px solid red;');", element, ) def before_click(self, element: WebElement, driver: Chrome | Firefox | Edge) -> None: + """Wait for element to be clickable before clicking. + + :param element: The WebElement to be clicked + :param driver: The WebDriver instance + """ wait = WebDriverWait(driver, 10) wait.until(expected_conditions.element_to_be_clickable(element))🧰 Tools
🪛 Ruff (0.8.2)
10-10: Missing docstring in public method
(D102)
19-19: Missing docstring in public method
(D102)
tests/workspaces_test.py (2)
39-39: Add return type annotation and docstringAccording to the static analysis hints, this method is missing a return type annotation and docstring.
- def test_rename_workspace(self, data: Data): + def test_rename_workspace(self, data: Data) -> None: + """Test renaming an existing workspace."""🧰 Tools
🪛 Ruff (0.8.2)
39-39: Missing return type annotation for public function
test_rename_workspaceAdd return type annotation:
None(ANN201)
39-39: Missing docstring in public method
(D102)
85-85: Add return type annotation and docstringAccording to the static analysis hints, this method is missing a return type annotation and docstring.
- def test_search_project(self, data: Data): + def test_search_project(self, data: Data) -> None: + """Test searching for an existing project."""🧰 Tools
🪛 Ruff (0.8.2)
85-85: Missing return type annotation for public function
test_search_projectAdd return type annotation:
None(ANN201)
85-85: Missing docstring in public method
(D102)
.pre-commit-config.yaml (1)
31-38: Great addition of Ruff for linting and formatting!Adding Ruff as a replacement for multiple individual linting and formatting tools is an excellent choice that will simplify your workflow. However, I notice both hooks have
continue_on_error: truewhich means linting and formatting errors won't cause pre-commit to fail. This might allow issues to slip through.Consider if this is intentional or if you'd prefer to fail on errors at least for the linting step:
- id: ruff args: [ --fix ] - continue_on_error: truepages/base_page.py (5)
13-13: Good modernization of type annotationsThe updated syntax for union types (using the pipe
|operator) aligns with Python 3.10+ standards. Consider adding a return type annotation as suggested by static analysis:- def __init__(self, driver: Chrome | Firefox | Edge, wait: WebDriverWait): + def __init__(self, driver: Chrome | Firefox | Edge, wait: WebDriverWait) -> None:🧰 Tools
🪛 Ruff (0.8.2)
13-13: Missing return type annotation for special method
__init__Add return type annotation:
None(ANN204)
13-13: Missing docstring in
__init__(D107)
58-61: Missing docstring in public methodConsider adding a docstring to the
clickmethod to improve code documentation:def click(self, locator: tuple[str, str]) -> None: + """Click on an element identified by the given locator. + + Parameters + ---------- + locator : tuple[str, str] + A tuple containing the locator strategy and locator value. + """ el: WebElement = self.wait.until(expected_conditions.element_to_be_clickable(locator)) self._highlight_element(el, "green") el.click()🧰 Tools
🪛 Ruff (0.8.2)
58-58: Missing docstring in public method
(D102)
63-68: Missing docstring in public methodConsider adding a docstring to the
fill_textmethod to improve code documentation:def fill_text(self, locator: tuple[str, str], txt: str) -> None: + """Fill text into an element identified by the given locator. + + Parameters + ---------- + locator : tuple[str, str] + A tuple containing the locator strategy and locator value. + txt : str + The text to enter into the element. + """ el: WebElement = self.wait.until(expected_conditions.element_to_be_clickable(locator)) el.clear() self._highlight_element(el, "green") el.send_keys(txt)🧰 Tools
🪛 Ruff (0.8.2)
63-63: Missing docstring in public method
(D102)
69-72: Missing docstring in public methodConsider adding a docstring to the
clear_textmethod to improve code documentation:def clear_text(self, locator: tuple[str, str]) -> None: + """Clear text from an element identified by the given locator. + + Parameters + ---------- + locator : tuple[str, str] + A tuple containing the locator strategy and locator value. + """ el: WebElement = self.wait.until(expected_conditions.element_to_be_clickable(locator)) el.clear()🧰 Tools
🪛 Ruff (0.8.2)
69-69: Missing docstring in public method
(D102)
80-84: Missing docstring in public methodConsider adding a docstring to the
get_textmethod to improve code documentation:def get_text(self, locator: tuple[str, str]) -> str: + """Get text from an element identified by the given locator. + + Parameters + ---------- + locator : tuple[str, str] + A tuple containing the locator strategy and locator value. + + Returns + ------- + str + The text content of the element. + """ el: WebElement = self.wait.until(expected_conditions.visibility_of_element_located(locator)) self._highlight_element(el, "green") return el.text🧰 Tools
🪛 Ruff (0.8.2)
80-80: Missing docstring in public method
(D102)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
.pre-commit-config.yaml(3 hunks)README.md(2 hunks)pages/about_page.py(1 hunks)pages/base_page.py(3 hunks)pages/forgot_password_page.py(1 hunks)pages/login_page.py(1 hunks)pages/project_edit_page.py(1 hunks)pages/project_type_page.py(1 hunks)pages/projects_page.py(7 hunks)pages/templates_page.py(1 hunks)pyproject.toml(2 hunks)tests/base_test.py(1 hunks)tests/conftest.py(9 hunks)tests/db_test.py(1 hunks)tests/dependency_class_test.py(1 hunks)tests/email_test.py(1 hunks)tests/forgot_password_test.py(1 hunks)tests/login_test.py(3 hunks)tests/workspaces_test.py(5 hunks)utilities/excel_parser.py(1 hunks)utilities/mailinator_helper.py(5 hunks)utilities/vrt_helper.py(4 hunks)utilities/web_driver_listener.py(1 hunks)
✅ Files skipped from review due to trivial changes (11)
- tests/db_test.py
- README.md
- pages/about_page.py
- tests/forgot_password_test.py
- utilities/mailinator_helper.py
- pages/project_type_page.py
- tests/login_test.py
- tests/conftest.py
- pages/project_edit_page.py
- pages/forgot_password_page.py
- pages/login_page.py
🧰 Additional context used
🧬 Code Definitions (2)
tests/email_test.py (2)
tests/conftest.py (1)
mailinator_helper(98-102)utilities/mailinator_helper.py (1)
get_message(80-104)
tests/workspaces_test.py (3)
utilities/data.py (1)
Data(33-36)pages/projects_page.py (5)
rename_workspace(95-116)is_workspace_found(174-179)get_projects_number_from_workspace(166-171)delete_project(131-146)get_projects_number_in_page(159-163)enums/status.py (1)
Status(4-6)
🪛 Ruff (0.8.2)
utilities/vrt_helper.py
60-60: Missing return type annotation for public function shoot_page_ang_ignore_elements
Add return type annotation: None
(ANN201)
98-98: Missing return type annotation for public function shoot_element
Add return type annotation: None
(ANN201)
utilities/web_driver_listener.py
10-10: Missing docstring in public method
(D102)
19-19: Missing docstring in public method
(D102)
pages/base_page.py
13-13: Missing return type annotation for special method __init__
Add return type annotation: None
(ANN204)
13-13: Missing docstring in __init__
(D107)
49-49: Line too long (103 > 100)
(E501)
58-58: Missing docstring in public method
(D102)
63-63: Missing docstring in public method
(D102)
69-69: Missing docstring in public method
(D102)
80-80: Missing docstring in public method
(D102)
pages/projects_page.py
149-149: Missing docstring in public method
(D102)
166-166: Missing docstring in public method
(D102)
174-174: Missing docstring in public method
(D102)
pages/templates_page.py
13-13: Missing return type annotation for special method __init__
Add return type annotation: None
(ANN204)
13-13: Missing docstring in __init__
(D107)
13-13: Missing type annotation for function argument driver
(ANN001)
13-13: Missing type annotation for function argument wait
(ANN001)
16-16: Missing docstring in public method
(D102)
tests/dependency_class_test.py
13-13: Missing return type annotation for public function test_e
Add return type annotation: None
(ANN201)
14-14: Line too long (108 > 100)
(E501)
tests/workspaces_test.py
39-39: Missing return type annotation for public function test_rename_workspace
Add return type annotation: None
(ANN201)
39-39: Missing docstring in public method
(D102)
85-85: Missing return type annotation for public function test_search_project
Add return type annotation: None
(ANN201)
85-85: Missing docstring in public method
(D102)
🔇 Additional comments (22)
pages/templates_page.py (1)
10-11: Modernized type annotations for UI selectors.
The conversion fromTuple[str, str]to the built-intuple[str, str]is appropriate and aligns with modern Python type hinting.pages/projects_page.py (1)
12-64: Consistent type annotation modernization for UI selectors.
All UI element selector attributes have been updated from usingTuple[str, str]to the built-intuple[str, str], which is a clear and modern approach since Python 3.9. The changes enhance code readability and consistency.tests/dependency_class_test.py (1)
9-11: LGTM! Docstring formatting looks good.The reformatted docstring improves code consistency.
🧰 Tools
🪛 Ruff (0.8.2)
9-11: 1 blank line required between summary line and description
(D205)
utilities/excel_parser.py (1)
20-20: LGTM! Single-line formatting is good.The reformatted line improves readability while maintaining functionality.
utilities/web_driver_listener.py (2)
10-11: LGTM! Nice type annotation updates.The modernized type annotations using the pipe operator for union types and built-in generics improves code quality.
🧰 Tools
🪛 Ruff (0.8.2)
10-10: Missing docstring in public method
(D102)
19-19: LGTM! Improved type annotation.The update to modern union type syntax is consistent with other changes.
🧰 Tools
🪛 Ruff (0.8.2)
19-19: Missing docstring in public method
(D102)
utilities/vrt_helper.py (2)
11-11: LGTM! Clean import formatting.The consolidated import line improves readability.
29-29: LGTM! Updated type annotation.The modernized type annotation using the pipe operator for union types improves code quality.
tests/email_test.py (1)
18-18: Formatting improvement looks goodThe function call has been properly formatted to a single line, improving readability while maintaining the same functionality.
tests/base_test.py (1)
18-18: Type annotation modernization is appropriateThe type annotation has been updated from
Union[Chrome, Firefox, Edge]toChrome | Firefox | Edge, using the newer Python 3.10+ syntax for union types. This is a good modernization without changing functionality.tests/workspaces_test.py (8)
34-34: Formatting improvement looks goodThe assertion has been properly formatted to a single line, improving readability.
40-43: Method call and assertion formatting looks goodThe method call and assertion have been reformatted to be more readable with appropriate line breaks.
61-61: Formatting improvement looks goodThe method call has been properly formatted to a single line, improving readability.
80-80: Formatting improvement looks goodThe assertion has been properly formatted to a single line, improving readability.
87-87: Formatting improvement looks goodThe variable assignment has been properly formatted to a single line, improving readability.
104-104: Formatting improvement looks goodThe method call has been properly formatted to a single line, improving readability.
106-106: Formatting improvement looks goodThe assertion has been properly formatted to a single line, improving readability.
117-119: Formatting improvement looks goodThe assertion has been properly formatted with appropriate line breaks, improving readability.
pyproject.toml (3)
5-9: Ruff migration looks goodThe replacement of
blackandisortwithruffin the dev dependencies is a good modernization. Ruff combines multiple linting and formatting tools into one, improving tooling efficiency.
74-83: Ruff configuration looks appropriateThe Ruff configuration includes common best practices:
- Setting appropriate line length
- Targeting Python 3.11
- Selecting all linting rules with specific ignores for conflicting rules
This comprehensive setup will help maintain code quality.
85-87: Ruff formatting configuration looks goodThe formatting configuration with double quotes and proper docstring code formatting follows common Python standards.
pages/base_page.py (1)
38-45: Docstring format improvementGood update to the docstring format using the NumPy style with section headers and separator lines. This format is more maintainable and consistent.
utilities/vrt_helper.py
Outdated
| def shoot_page_ang_ignore_elements( | ||
| self, baseline_name: str, elements: list[WebElement] | ||
| ): | ||
| def shoot_page_ang_ignore_elements(self, baseline_name: str, elements: list[WebElement]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add return type annotation and fix method name.
The method signature has been reformatted well, but it's missing a return type annotation according to static analysis.
- def shoot_page_ang_ignore_elements(self, baseline_name: str, elements: list[WebElement]):
+ def shoot_page_ang_ignore_elements(self, baseline_name: str, elements: list[WebElement]) -> None:Also, there appears to be a typo in the method name ("ang" should be "and"), but this may be addressed in a separate PR.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def shoot_page_ang_ignore_elements(self, baseline_name: str, elements: list[WebElement]): | |
| def shoot_page_ang_ignore_elements(self, baseline_name: str, elements: list[WebElement]) -> None: |
🧰 Tools
🪛 Ruff (0.8.2)
60-60: Missing return type annotation for public function shoot_page_ang_ignore_elements
Add return type annotation: None
(ANN201)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
pages/projects_page.py (1)
193-193: Logic fix inis_project_foundmethod properly implemented.The method now correctly uses
any()instead ofall()to check if any project title matches the requested name, not all of them. This aligns with the expected behavior and is consistent with the similaris_workspace_foundmethod.
🧹 Nitpick comments (2)
pages/projects_page.py (2)
101-101: Consider simplifying the any() check.The current implementation works but could be simplified for better readability.
-flag = any(old_name in workspaces_text_list[i] for i in range(len(workspaces_text_list))) +flag = old_name in workspaces_text_list
149-149: Add docstrings to public methods.The static analysis tool has identified missing docstrings for these public methods. Adding docstrings would improve code documentation and meet the project's style guidelines.
Example for
get_workspaces_number:@allure.step("Get workspaces number") def get_workspaces_number(self) -> int: """Return the total number of workspaces available to the user.""" # existing implementation...Similar docstrings should be added to
get_projects_number_from_workspaceandis_workspace_found.Also applies to: 166-166, 174-174
🧰 Tools
🪛 Ruff (0.8.2)
149-149: Missing docstring in public method
(D102)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
pages/projects_page.py(7 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
pages/projects_page.py
149-149: Missing docstring in public method
(D102)
166-166: Missing docstring in public method
(D102)
174-174: Missing docstring in public method
(D102)
🔇 Additional comments (1)
pages/projects_page.py (1)
12-63: Type annotation modernization looks good.The change from
Tuple[str, str]totuple[str, str]for class attributes follows PEP 585, which allows using built-in collection types as generic types instead of their capitalized counterparts from the typing module. This change aligns with modern Python typing practices (Python 3.9+).
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Summary by CodeRabbit