Skip to content

feat: add ci section and bump pre-commit hooks #140

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

Merged
merged 3 commits into from
May 20, 2025

Conversation

shenxianpeng
Copy link
Contributor

@shenxianpeng shenxianpeng commented May 17, 2025

Summary by CodeRabbit

  • Chores
    • Updated tool versions used for code quality and linting checks.
    • Improved configuration for automated updates of pre-commit tools.
    • Enhanced test coverage settings to exclude specific initialization files.

@shenxianpeng shenxianpeng added the enhancement New feature or request label May 17, 2025
Copy link

coderabbitai bot commented May 17, 2025

Walkthrough

The .pre-commit-config.yaml file was updated to add a new ci section with a quarterly autoupdate schedule and to upgrade pinned versions of several pre-commit hook repositories. Minor formatting changes were made in cpp_linter/clang_tools/clang_tidy.py and cpp_linter/clang_tools/patcher.py without altering logic or public interfaces. The coverage configuration in pyproject.toml was updated to exclude cpp_linter/__init__.py from coverage measurement.

Changes

File(s) Change Summary
.pre-commit-config.yaml Added ci section with autoupdate_schedule: quarterly. Upgraded versions of multiple pre-commit hooks.
cpp_linter/clang_tools/clang_tidy.py Changed string delimiters from single to double quotes in markdown code block fence formatting.
cpp_linter/clang_tools/patcher.py Reformatted assertion statement in get_suggestions_from_patch method to a single-line style.
pyproject.toml Updated coverage run config to omit cpp_linter/__init__.py from coverage measurement.

Poem

A rabbit hopped to pre-commit land,
Tweaking configs with a gentle hand.
Quarterly updates now in sight,
Hook versions bumped to shiny new height.
Coverage trimmed with careful care—
Clean and neat, the code we share!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 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 273485c and 0688b90.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms (28)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)
  • GitHub Check: test (3.11, windows-latest, 16)
  • GitHub Check: test (3.10, ubuntu-22.04, 16)
  • GitHub Check: test (3.10, windows-latest, 14)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f01a6b1 and aa8a9d7.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.pre-commit-config.yaml

[error] 1-1: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
.pre-commit-config.yaml (3)

28-28:

❓ Verification inconclusive

Check mirrors-mypy upgrade to v1.15.0.

Bumping your MyPy mirror to v1.15.0 can tighten type checks. Please re-run type checking and address any new errors, especially around third-party stubs (types-requests, rich, etc.).


🏁 Script executed:

#!/bin/bash
# Run MyPy to detect any new type errors
mypy .

Length of output: 103


Verify MyPy mirror upgrade to v1.15.0

The sandbox couldn’t run MyPy (mypy: command not found), so we couldn’t confirm whether the bump to v1.15.0 introduces new errors. Please:

  • Ensure MyPy is installed in your environment (e.g. activate your venv or run pip install -r requirements-dev.txt).
  • Re-run type checking against the full codebase.
  • Address any new errors, particularly in third-party stubs (types-requests, rich, etc.).
  • Confirm all type checks pass before merging.

39-39:

❓ Verification inconclusive

Validate cspell-cli update to v9.0.1.

Ensure the spelling dictionary and command-line interface haven't changed flags or default behaviors in v9.x. Run cspell on your docs/tests to confirm no regressions.


🏁 Script executed:

#!/bin/bash
# Spell-check the repository to catch any new issues
cspell --no-progress .

Length of output: 121


Verify cspell-cli v9.0.1 update

Ensure the CLI install and invocation still work and haven’t introduced any breaking changes to flags or defaults. For example, install and run:

npm install cspell-cli@9.0.1 --no-save
npx cspell --no-progress .

Confirm no new spelling errors are reported across docs/tests and adjust the command if any flags or defaults have changed.


21-21:

❓ Verification inconclusive

Verify Ruff pre-commit bump to v0.11.10.

Upgrading astral-sh/ruff-pre-commit from v0.6.4 to v0.11.10 may introduce new lint rules or change defaults. Run your full test suite and inspect diagnostics to ensure no unexpected failures.


🏁 Script executed:

#!/bin/bash
# Run ruff against the codebase to catch any new lint errors
ruff --exit-zero .

Length of output: 137


🏁 Script executed:

#!/bin/bash
# Display available commands and options for Ruff
ruff --help

# Test running Ruff check with --exit-zero flag
ruff check . --exit-zero

Length of output: 1750


Ruff pre-commit bump to v0.11.10: lint clean but please run full test suite

Running the correct lint command shows no new diagnostics:

ruff check . --exit-zero
# → All checks passed!

Please also run your full test suite to ensure there are no unexpected failures before merging.

@2bndy5
Copy link
Contributor

2bndy5 commented May 17, 2025

This isn't an enhancement really. It is more like a chore.

And I don't see a new "CI section".

I think the title could be

chore: bump pre-commit hooks

@shenxianpeng shenxianpeng added dependencies and removed enhancement New feature or request labels May 17, 2025
@shenxianpeng shenxianpeng changed the title feat: bump pre-commit hooks and add ci section feat: add ci section and bump pre-commit hooks May 17, 2025
@shenxianpeng shenxianpeng added the enhancement New feature or request label May 17, 2025
@shenxianpeng
Copy link
Contributor Author

shenxianpeng commented May 19, 2025

coverage works last time (coverage==7.7.1) but now it failed (coverage==7.8.0).

? Myabe we should pin coverage==7.7.1 to have a try, or omit the cpp-linter/__init__.py from

omit = [
# don't include tests in coverage
# "tests/*",
]

@2bndy5
Copy link
Contributor

2bndy5 commented May 19, 2025

That's a good idea.

The reason the CI is failing is because one of the coverage data files uses absolute paths even though it is supposed to use relative paths.

I've seen this error before v7.8, but usually I was able to fix it by re-running all the jobs in the test CI.

Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f01a6b1) to head (0688b90).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #140   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         1869      1869           
=========================================
  Hits          1869      1869           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shenxianpeng shenxianpeng merged commit 139c89d into main May 20, 2025
145 checks passed
@shenxianpeng shenxianpeng deleted the bump-pre-commit-hook branch May 20, 2025 07:24
@shenxianpeng
Copy link
Contributor Author

Coverage report still failing after this PR merged into the main branch

https://github.com/cpp-linter/cpp-linter/actions/runs/15131437255/job/42590531046

@2bndy5
Copy link
Contributor

2bndy5 commented May 21, 2025

Yep. It is an infrequent error in coverage combine command. I think it is related to how we chdir() and multi-task. It is hard to create steps-to-reproduce for diagnosis, see coverage.py related issues. It is definitely related to coverage data collected from Windows runners, but I don't know if that is because we run coverage combine in Linux.

I don't remember if this happened before we merged #92. Whenever it does happen, I found that just re-running all jobs would fix it (eventually, may take more than 1 re-run). It is weird that the error happens more often now; last year, it only happened rarely.

@2bndy5
Copy link
Contributor

2bndy5 commented May 21, 2025

I think we could instead upload multiple reports to codecov, but that is not a simple patch.

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.

2 participants