-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Make ruff sort imports #47
Conversation
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.
Feedback from Senior Dev Bot
import pytest | ||
import requests_mock | ||
import tyora | ||
|
||
|
||
def test_parse_args_missing_args() -> None: |
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.
CODE REVIEW
- No need to re-import
tyora
afterrequests_mock
. - Ensure imports are sorted alphabetically.
import pytest
import requests_mock
import tyora
This keeps imports clean and manageable.
import io | ||
from html.parser import HTMLParser | ||
from typing import Optional | ||
from xml.etree.ElementTree import Element | ||
|
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.
CODE REVIEW
Great addition of Optional
from the typing
module. Minor formatting improvement: maintain alphabetical order.
from html.parser import HTMLParser
from typing import Optional
from xml.etree.ElementTree import Element
import io
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
args: [ --fix ] | ||
args: [ --select, I, --fix ] | ||
# Run the formatter. | ||
- id: ruff-format | ||
- repo: https://github.com/pre-commit/mirrors-mypy |
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.
CODE REVIEW
Your changes improve the specific linting rules applied. However:
- Validate that
ruff-format
aligns with your code style. - Ensure the removed
repo:
formypy
is intentional.
Example:
hooks:
- id: ruff
args: [ --select I, --fix ]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
id: mypy
import argparse | ||
import json | ||
import logging | ||
from dataclasses import dataclass, field | ||
from enum import Enum | ||
from getpass import getpass | ||
import logging | ||
import json | ||
from urllib.parse import urljoin | ||
from pathlib import Path | ||
from time import sleep | ||
from typing import AnyStr, Optional | ||
from urllib.parse import urljoin | ||
from xml.etree.ElementTree import Element, tostring | ||
|
||
from html2text import html2text | ||
import htmlement | ||
import requests | ||
|
||
from html2text import html2text | ||
|
||
logger = logging.getLogger(name="tyora") | ||
|
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.
CODE REVIEW
Your import reorganization improves readability, but some imports still need adjustments.
- Standard Imports First: Arrange built-in modules before third-party ones.
- Alphabetical Order: Sort imports alphabetically within each group.
import argparse
import json
import logging
from dataclasses import dataclass, field
from enum import Enum
from getpass import getpass
from pathlib import Path
from time import sleep
from typing import AnyStr, Optional
from urllib.parse import urljoin
from xml.etree.ElementTree import Element, tostring
import html2text
import htmlement
import requests
WalkthroughThe recent changes primarily focus on reordering import statements across multiple files to improve code organization and readability. Additionally, the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- .pre-commit-config.yaml (1 hunks)
- src/tyora/init.py (1 hunks)
- stubs/htmlement.pyi (1 hunks)
- tests/test_tyora.py (1 hunks)
Files skipped from review due to trivial changes (3)
- .pre-commit-config.yaml
- stubs/htmlement.pyi
- tests/test_tyora.py
Additional comments not posted (1)
src/tyora/__init__.py (1)
2-3
: Reordered imports and addedhtml2text
import.The reordering of imports and the addition of
html2text
align with Python's best practices of grouping and ordering imports. This change improves readability and maintainability.Also applies to: 15-15
Summary by CodeRabbit
Chores
Refactor