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

Cog 650 replace pylint #382

Merged
merged 15 commits into from
Dec 26, 2024
Merged

Cog 650 replace pylint #382

merged 15 commits into from
Dec 26, 2024

Conversation

dexters1
Copy link
Collaborator

@dexters1 dexters1 commented Dec 18, 2024

  • add check for ruff formatting

  • add check for ruff linting

  • add git hook for ruff ( run locally: pre-commit install to add git hook for ruff. Make sure to run poetry install beforehand to install pre-commit )

  • Run ruff check to lint code in local

  • Run ruff format to format code in local

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced new GitHub Actions workflows for code formatting and linting using Ruff.
    • Added pre-commit hooks for enhancing code quality and consistency.
  • Dependencies

    • Added pre-commit as a new dependency for the project.
  • Configuration

    • Updated linting rules and configurations for Ruff in the project settings, including new ignore rules.

Vasilije1990 and others added 5 commits December 17, 2024 18:53
Resolve syntax issue with cognify router

Fix
Added formatting and linting on pre-commit hook

Feature COG-650
Update ruff lint options in pyproject file

Chore
Added linting check with ruff in github actions

Test COG-650
@dexters1 dexters1 self-assigned this Dec 18, 2024
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

This pull request introduces new GitHub Actions workflows for code formatting and linting using Ruff, along with a configuration for pre-commit hooks. The workflows are triggered on pull requests and ensure that code adheres to specified formatting and linting rules. Additionally, the pyproject.toml file is updated to include a new dependency for pre-commit and to configure Ruff's linting rules, enhancing the project's code quality management.

Changes

File Change Summary
.github/workflows/ruff_format.yaml New workflow to check code formatting using Ruff on pull requests
.github/workflows/ruff_lint.yaml New workflow to perform linting using Ruff on pull requests
.pre-commit-config.yaml Added pre-commit hooks for trailing whitespace, file fixes, YAML checks, and Ruff linting/formatting
pyproject.toml Added pre-commit dependency, configured Ruff linting rules

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant PC as Pre-Commit
    participant Ruff as Ruff Linter/Formatter
    participant GHA as GitHub Actions

    Dev->>PC: Commit code
    PC->>Ruff: Run linting and formatting
    Ruff-->>Dev: Provide feedback
    Dev->>GHA: Open Pull Request
    GHA->>Ruff: Run linting and formatting checks
    Ruff-->>GHA: Validation results
Loading

Poem

🐰 Code's new guardian, Ruff so bright,
Formatting and linting with delight!
Pre-commit hooks dance, workflows sing,
Clean code's the treasure they will bring.
Hop, hop, hooray for quality's might! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e31033c and 74e136b.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • pyproject.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml

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. (Beta)
  • @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.

dexters1 and others added 5 commits December 18, 2024 14:24
Remove changes to cognify router

Refactor COG-650
Test if code is formatted for cognee

Test COG-650
Rename ruff gh actions to be more understandable

Refactor COG-650
Remove checking of ruff lint and format on push

Chore COG-650
@dexters1 dexters1 marked this pull request as ready for review December 18, 2024 14:02
Copy link
Contributor

@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: 2

🧹 Nitpick comments (3)
.pre-commit-config.yaml (2)

4-10: Consider updating pre-commit-hooks version

The pre-commit-hooks repository is using v3.2.0 which is quite old. The latest version is v4.5.0 which includes various improvements and bug fixes.

-    rev: v3.2.0
+    rev: v4.5.0

11-20: Consider adding additional Ruff configuration parameters

The basic setup looks good, but consider adding these parameters to enhance functionality:

  • args: [--fix] for auto-fixing issues
  • args: [--line-length=100] to match your pyproject.toml configuration
    - id: ruff
      types_or: [ python, pyi ]
+     args: [--fix, --line-length=100]
    - id: ruff-format
      types_or: [ python, pyi ]
+     args: [--line-length=100]
pyproject.toml (1)

77-77: Fix formatting: Remove extra empty lines

Remove the extra empty lines after the pre-commit dependency.

 pre-commit = "^4.0.1"
-

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3b8d8a and e31033c.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/ruff_format.yaml (1 hunks)
  • .github/workflows/ruff_lint.yaml (1 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • pyproject.toml (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/ruff_lint.yaml
  • .github/workflows/ruff_format.yaml

.pre-commit-config.yaml Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
Copy link

gitguardian bot commented Dec 20, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
9573981 Triggered Generic Password a90a232 notebooks/hr_demo.ipynb View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Vasilije1990 Vasilije1990 merged commit 227bb9b into dev Dec 26, 2024
22 of 26 checks passed
@Vasilije1990 Vasilije1990 deleted the COG-650-replace-pylint branch December 26, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants