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: Trunk and flake8 configs #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

phuongfi91
Copy link
Contributor

@phuongfi91 phuongfi91 commented Mar 4, 2025

Summary by Sourcery

Updates Trunk configuration to include new linters and update existing ones. Updates flake8 configuration to ignore some errors in test files.

Chores:

  • Update Trunk configuration to include new linters and update existing ones.
  • Update flake8 configuration to ignore some errors in test files.

Summary by CodeRabbit

  • Chores
    • Refined quality checks to allow more flexible formatting by permitting longer lines and easing string literal restrictions in test code.
    • Upgraded and expanded our code analysis framework with updated tools and additional analyzers, enhancing overall static analysis and adherence to modern standards.

@phuongfi91 phuongfi91 requested review from jhassine and Copilot March 4, 2025 14:07
Copy link

sourcery-ai bot commented Mar 4, 2025

Reviewer's Guide by Sourcery

This pull request updates the trunk and flake8 configurations. The trunk configuration is updated with new linter versions and new linters. The flake8 configuration is updated to ignore E501 globally and WPS226 for test files.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Updated the .trunk/trunk.yaml file to update linter versions and add new linters.
  • Updated bandit from 1.8.2 to 1.8.3.
  • Added checkov@3.2.379.
  • Added codespell@2.4.1.
  • Added cspell@8.17.5.
  • Added djlint@1.36.4.
  • Added flake8@7.1.2.
  • Added gitleaks@8.24.0.
  • Added hadolint@2.12.1-beta.
  • Added markdown-link-check@3.13.6.
  • Added markdown-table-prettify@3.6.0.
  • Added markdownlint-cli2@0.17.2.
  • Updated mypy from 1.14.1 to 1.15.0.
  • Updated prettier from 3.4.2 to 3.5.3.
  • Added pyright@1.1.396.
  • Updated renovate from 39.141.0 to 39.185.0.
  • Updated ruff from 0.9.3 to 0.9.9.
  • Added semgrep@1.110.0.
  • Added trivy@0.59.1.
  • Updated trufflehog from 3.88.3 to 3.88.14.
  • Added vale@3.9.6.
nitpick_styles/generic-trunk.toml
Updated the nitpick_styles/generic-flake8.toml file to include E501 in the ignore list and add WPS226 to the ignored warnings for test files.
  • Added E501 to the global ignore list.
  • Added WPS226 to the ignored warnings for files matching tests/*.py.
nitpick_styles/generic-flake8.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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

coderabbitai bot commented Mar 4, 2025

Warning

Rate limit exceeded

@phuongfi91 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4a6334e and 08b6eee.

📒 Files selected for processing (1)
  • nitpick_styles/generic-flake8.toml (2 hunks)

Walkthrough

The pull request updates two linting configuration files. In nitpick_styles/generic-flake8.toml, the ignored rules list now includes E501 globally and WPS226 for files matching "tests/*.py". In nitpick_styles/generic-trunk.toml, several linters have been added and existing linter versions have been updated, modifying the configuration under [".trunk/trunk.yaml".lint].

Changes

File Change Summary
nitpick_styles/generic-flake8.toml Added rule E501 to the global ignore list; added rule WPS226 to the per-file ignore for "tests/*.py".
nitpick_styles/generic-trunk.toml Updated linter versions for bandit (1.8.2 → 1.8.3), prettier (3.4.2 → 3.5.3), renovate (39.141.0 → 39.185.0), ruff (0.9.3 → 0.9.9), trufflehog (3.88.3 → 3.88.14), mypy (1.14.1 → 1.15.0), and markdownlint (to markdownlint-cli2@0.17.2); added linters: checkov@3.2.379, codespell@2.4.1, cspell@8.17.5, djlint@1.36.4, flake8@7.1.2, gitleaks@8.24.0, hadolint@2.12.1-beta, markdown-link-check@3.13.6, markdown-table-prettify@3.6.0, semgrep@1.110.0, trivy@0.59.1, and vale@3.9.6; yamllint@1.35.1 remains unchanged.

Suggested Reviewers

  • jhassine

Poem

I’m hopping along through the code’s array,
With every update, I skip and play.
New rules added and versions refined,
A configuration garden, perfectly lined.
I nibble on carrots and code with delight—
A rabbit’s ode to changes bright!
🥕🐇


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @phuongfi91, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on updating the Trunk and Flake8 configurations. It includes changes to the .toml files that define the linting and formatting rules for the project. Specifically, it updates the versions of several linters and formatters used by Trunk, and it also adjusts the Flake8 configuration to ignore certain error codes in specific files. The goal is to keep the project's linting and formatting configurations up-to-date and to improve the overall code quality.

Highlights

  • Trunk Configuration Update: The .trunk/trunk.yaml file has been updated to include newer versions of various linters and tools, such as bandit, checkov, codespell, cspell, djlint, flake8, gitleaks, hadolint, markdown-link-check, markdown-table-prettify, markdownlint-cli2, mypy, prettier, pyright, renovate, ruff, semgrep, trivy, and trufflehog. This ensures that the project is using the latest versions of these tools and benefits from their latest features and bug fixes.
  • Flake8 Configuration Adjustments: The nitpick_styles/generic-flake8.toml file has been modified to ignore the E501 error code (line too long) globally and to ignore the WPS226 error code (overuse of string literals) in test files. This allows for more flexibility in code formatting and reduces the number of unnecessary warnings.

Changelog

  • nitpick_styles/generic-flake8.toml
    • Added E501 to the global ignore list to allow for longer lines.
    • Added WPS226 to the ignore list for test files to allow for more string literals in tests.
  • nitpick_styles/generic-trunk.toml
    • Updated versions of various linters and tools, including bandit, checkov, codespell, cspell, djlint, flake8, gitleaks, hadolint, markdown-link-check, markdown-table-prettify, markdownlint-cli2, mypy, prettier, pyright, renovate, ruff, semgrep, trivy, and trufflehog.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Trivia time!

Which popular Python linter was originally created by Google?

Click here for the answer
Pylint was originally created by Google employee, David R. MacIver.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request updates Trunk and flake8 configurations, including tool versions and ignored rules. The changes aim to keep the linting and formatting tools up-to-date and aligned with the project's style guidelines. Overall, the changes seem reasonable and contribute to maintaining code quality.

Merge Readiness

The pull request updates configuration files for linting and formatting tools. Given the nature of these changes, it's important to ensure that the updated configurations don't introduce any unintended consequences or break existing workflows. Since no major issues were found, the pull request appears to be ready for merging, but it's recommended to have another reviewer double-check the changes before merging. I am unable to directly approve the pull request, and users should have others review and approve this code before merging.

Copy link

@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 @phuongfi91 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • It might be helpful to add a brief explanation of why these trunk and flake8 configurations are being updated.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 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.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR updates the configuration for trunk and flake8 linting by bumping tool versions and adding new linting tools to the trunk config, as well as refining the list of ignored errors in the flake8 config.

  • Updated tool versions and added new linting integrations in generic-trunk.toml.
  • Modified the flake8 ignore list by adding E501 and including WPS226 in the test configuration.

Reviewed Changes

File Description
nitpick_styles/generic-trunk.toml Updated various linter tool versions and added additional linters.
nitpick_styles/generic-flake8.toml Appended E501 to the ignore list and added WPS226 for tests.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +74 to +75
W504,\
E501\
Copy link
Preview

Copilot AI Mar 4, 2025

Choose a reason for hiding this comment

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

The addition of E501 to the ignore list may inadvertently suppress line length warnings, which could affect code readability. Please confirm that ignoring this error code is intentional.

Suggested change
W504,\
E501\
W504\

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

2 participants