Skip to content
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

updated ruff, and updated code accordingly #218

Merged
merged 2 commits into from
Nov 23, 2024
Merged

Conversation

TeKrop
Copy link
Owner

@TeKrop TeKrop commented Nov 23, 2024

Summary by Sourcery

Refactor FastAPI route query parameters to use 'Annotated' type for better type hinting. Update ruff to version 0.8.0 and remove sourcery from pre-commit hooks. Bump project version to 3.6.1.

Enhancements:

  • Refactor code to use Python's 'Annotated' type for query parameters in FastAPI routes, improving type hinting and readability.

Build:

  • Update ruff version to 0.8.0 in pre-commit configuration and pyproject.toml, removing sourcery from pre-commit hooks.

Chores:

  • Bump project version from 3.6.0 to 3.6.1 in pyproject.toml.

@TeKrop TeKrop added the enhancement New feature or request label Nov 23, 2024
@TeKrop TeKrop self-assigned this Nov 23, 2024
Copy link
Contributor

sourcery-ai bot commented Nov 23, 2024

Reviewer's Guide by Sourcery

This PR updates the Ruff linter to version 0.8.0 and makes necessary code adjustments to comply with the new version's requirements. The main changes involve updating the type annotation syntax in FastAPI route parameters using Python's Annotated type and removing the sourcery pre-commit hook.

Updated class diagram for FastAPI route parameters

classDiagram
    class search_players {
        +Annotated[str, Query]
        +Annotated[str, Query] order_by = "name:asc"
        +Annotated[int, Query] offset = 0
        +Annotated[int, Query] limit = 20
    }
    class get_player_stats_summary {
        +Annotated[PlayerGamemode | None, Query] gamemode = None
        +Annotated[PlayerPlatform | None, Query] platform = None
    }
    class get_player_career {
        +Annotated[PlayerGamemode | None, Query] gamemode = None
        +Annotated[PlayerPlatform | None, Query] platform = None
    }
    class list_heroes {
        +Annotated[Role | None, Query] role = None
        +Annotated[Locale, Query] locale = Locale.ENGLISH_US
    }
    class get_hero {
        +Annotated[HeroKey, Path] hero_key
        +Annotated[Locale, Query] locale = Locale.ENGLISH_US
    }
    class list_maps {
        +Annotated[MapGamemode | None, Query] gamemode = None
    }
    class list_roles {
        +Annotated[Locale, Query] locale = Locale.ENGLISH_US
    }
Loading

Updated class diagram for PlayerCareerParser

classDiagram
    class PlayerCareerParser {
        +valid_http_codes: ClassVar[list]
        +root_path
    }
    note for PlayerCareerParser "Removed attribute: timeout"
Loading

File-Level Changes

Change Details Files
Updated FastAPI route parameters to use Annotated type hints
  • Refactored Query parameters to use Annotated type hints with default values
  • Updated Path parameters to use Annotated type hints
  • Added explicit type hints for optional parameters using
None syntax
Updated development tools configuration
  • Upgraded Ruff from v0.7.2 to v0.8.0
  • Removed sourcery pre-commit hook
  • Added new Ruff rule selections (A, LOG, FAST)
  • Removed TD (flake8-todos) rule selection
.pre-commit-config.yaml
pyproject.toml
Removed unused timeout attribute
  • Removed timeout class variable from PlayerCareerParser class
app/players/parsers/player_career_parser.py
Bumped project version
  • Updated version from 3.6.0 to 3.6.1
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @TeKrop - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The removal of timeout from PlayerCareerParser seems to be a functional change mixed in with style updates. Was this intentional? Please verify this won't impact the caching behavior.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

app/players/router.py Show resolved Hide resolved
Copy link

sonarcloud bot commented Nov 23, 2024

@TeKrop TeKrop merged commit 5ba2379 into main Nov 23, 2024
3 checks passed
@TeKrop TeKrop deleted the feature/update-ruff branch November 23, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant