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

chore: add Ruff #7

Merged
merged 1 commit into from
Jul 27, 2024
Merged

chore: add Ruff #7

merged 1 commit into from
Jul 27, 2024

Conversation

iktakahiro
Copy link
Owner

@iktakahiro iktakahiro commented Jul 26, 2024

Summary by CodeRabbit

  • New Features

    • Transitioned to using ruff for code linting and formatting, replacing previous tools.
    • Enabled automatic code formatting on save within the development environment.
  • Bug Fixes

    • Removed unused nosetests configuration to streamline testing settings.
  • Chores

    • Simplified build commands in the Makefile for installation, testing, and formatting.
    • Updated development dependencies to enhance project coding standards and maintainability.

Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

The recent updates focus on enhancing the Python development environment by streamlining configuration files and improving code quality practices. Key changes include transitioning to ruff for linting and formatting, updating testing configurations to favor pytest, and restructuring Makefile commands for simplicity. These modifications promote a consistent coding style and enhance the overall developer experience, aligning with modern tooling preferences.

Changes

File Path Change Summary
.devcontainer/devcontainer.json Updated to use charliermarsh.ruff for formatting, enabled auto-formatting on save, and streamlined settings.
.vscode/settings.json Removed support for Nose tests, switched default formatter to ruff, and enabled auto-formatting on save.
Makefile Renamed install to sync, removed update, streamlined testing and formatting commands to use ruff.
dddpy/.../book/init.py Reformatted import statements for improved readability.
main.py Updated function signatures for better readability with multi-line parameters.
pyproject.toml Removed black, added ruff, and introduced configuration sections for linting and formatting settings.

Poem

🐇 In a land where code does hop,
We’ve swapped our tools and let them bop!
With ruff to guide and format right,
Our Python dreams take joyful flight.
Clean code we write, no time to stall,
Together we code, together we thrall! 🐇✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between be3dc68 and d2e8885.

Files ignored due to path filters (1)
  • requirements-dev.lock is excluded by !**/*.lock
Files selected for processing (6)
  • .devcontainer/devcontainer.json (1 hunks)
  • .vscode/settings.json (1 hunks)
  • Makefile (1 hunks)
  • dddpy/infrastructure/sqlite/book/init.py (1 hunks)
  • main.py (1 hunks)
  • pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (1)
  • main.py
Additional context used
Ruff
dddpy/infrastructure/sqlite/book/__init__.py

4-4: .book_repository.BookCommandUseCaseUnitOfWorkImpl imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .book_repository.BookRepositoryImpl imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

Additional comments not posted (11)
dddpy/infrastructure/sqlite/book/__init__.py (1)

3-6: LGTM! But verify the usage of imported entities.

The reformatting changes improve readability and maintain consistency. However, static analysis tools indicate that BookCommandUseCaseUnitOfWorkImpl and BookRepositoryImpl are imported but unused. Verify if these imports are necessary. If not, consider removing them or adding them to __all__.

Tools
Ruff

4-4: .book_repository.BookCommandUseCaseUnitOfWorkImpl imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .book_repository.BookRepositoryImpl imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

Makefile (3)

7-7: LGTM! Simplified and modernized build process.

The sync target simplifies the installation process by only including the $(RYE) sync command. This aligns with modern dependency management practices.


12-12: LGTM! Ensure the test target works correctly.

The test target now calls the sync command before executing tests with pytest. This ensures dependencies are synchronized before running tests.


14-15: LGTM! Streamlined formatting with ruff.

The format target now uses ruff for formatting, replacing isort and black. This change simplifies the formatting process.

.vscode/settings.json (1)

10-11: LGTM! Optimized development environment.

The changes reflect a strategic update to the development environment by removing Nose tests, changing the default formatter to ruff, and enabling format on save. These changes enhance testing and formatting practices.

pyproject.toml (4)

25-25: Addition of ruff as a development dependency.

The addition of ruff as a linter is appropriate and aligns with the shift from black to ruff.


34-38: Configuration for ruff linter.

The ruff configuration sets the line length and indentation width, which are standard settings. The target Python version is also specified.


40-45: Linting rules configuration.

The select and ignore rules are well-defined, focusing on specific error codes. The fixable and unfixable rules are also appropriately set.


47-61: Formatting rules configuration.

The formatting rules align with black's standards, ensuring consistency in code style. The settings for quote style, dummy variables, indentation, trailing commas, and line endings are well-chosen.

.devcontainer/devcontainer.json (2)

14-14: Type checking mode configuration.

Setting the type checking mode to "basic" is a reasonable default for most projects.


15-21: Configuration for ruff as the default formatter and code actions on save.

These settings ensure that ruff is used for formatting and organizing imports, and that formatting is applied automatically on save. This promotes a consistent code style and reduces manual tasks.

@iktakahiro iktakahiro merged commit 9e1b34e into main Jul 27, 2024
4 checks passed
@iktakahiro iktakahiro deleted the ruff branch July 27, 2024 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant