ci: add deterministic formatting and clean-worktree gates#68
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a Prettier-based deterministic formatting check into the lint pipeline, introduces a CI QA workflow gate to fail on post-lint working-tree changes, and documents these quality gates in the test catalog and CI/CD security plan. Sequence diagram for updated CI lint and clean-worktree gatesequenceDiagram
actor Developer
participant GitHub
participant QAWorkflow as QA_workflow_qa-matrix
participant Npm as npm_scripts
participant Git as git_CLI
Developer->>GitHub: Push commit or open PR
GitHub->>QAWorkflow: Trigger qa-matrix workflow
QAWorkflow->>Npm: npm run lint
activate Npm
Npm->>Npm: npm run format:check
Npm->>Npm: cross-env ESLINT_USE_FLAT_CONFIG=false eslint src tests
Npm->>Npm: npm run lint:md
Npm->>Npm: npm run changelog:validate
Npm-->>QAWorkflow: Exit code from lint pipeline
deactivate Npm
QAWorkflow->>Git: git diff --name-status --exit-code
Git-->>QAWorkflow: Exit code (nonzero if working tree dirty)
alt working tree clean
QAWorkflow->>Npm: npm test -- --runInBand
Npm-->>QAWorkflow: Test results
else working tree dirty
QAWorkflow-->>GitHub: Mark job failed (formatting or lint mutated files)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Review Summary by QodoAdd deterministic formatting and clean-worktree quality gates
WalkthroughsDescription• Add Prettier formatter drift detection to lint pipeline • Enforce clean working tree after linting in CI/CD • Document new quality gates in security plan • Update test catalog with formatter check coverage Diagramflowchart LR
A["npm run lint"] --> B["format:check"]
B --> C["ESLint"]
C --> D["Markdown lint"]
D --> E["Changelog validate"]
E --> F["git diff check"]
F --> G["Clean worktree verified"]
File Changes1. package.json
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 WalkthroughWalkthroughThe changes introduce Prettier formatter verification as a pre-linting step in the CI pipeline and add a post-linting validation gate to ensure no uncommitted changes remain after formatting checks. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @Mehdi-Bl, 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! This pull request enhances the project's continuous integration and delivery pipeline by introducing new quality gates. It ensures that all code adheres to a consistent formatting style through an automated check and prevents builds from passing if linting processes result in uncommitted changes, thereby improving overall code quality and build reliability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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. Footnotes
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
formatandformat:checkscripts use different file globs (the check omits JS/TS files), which may lead to code being auto-formatted locally but not enforced in CI; consider aligning the patterns or documenting the intentional difference. - The
git diff --name-status --exit-codestep will fail on any line-ending normalization or other non-functional changes introduced by tools; if this becomes noisy, you may want to restrict the diff to relevant paths or configure.gitattributesto avoid false positives.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `format` and `format:check` scripts use different file globs (the check omits JS/TS files), which may lead to code being auto-formatted locally but not enforced in CI; consider aligning the patterns or documenting the intentional difference.
- The `git diff --name-status --exit-code` step will fail on any line-ending normalization or other non-functional changes introduced by tools; if this becomes noisy, you may want to restrict the diff to relevant paths or configure `.gitattributes` to avoid false positives.
## Individual Comments
### Comment 1
<location> `package.json:26-27` </location>
<code_context>
"dev": "node scripts/index.js dev",
"clear-assets": "rimraf src/renderer/bundle.js src/renderer/bundle.js.map src/renderer/bundle.js.LICENSE.txt src/renderer/output.css",
- "lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src tests --ext .js,.jsx,.ts,.tsx --cache && npm run lint:md && npm run changelog:validate",
+ "lint": "npm run format:check && cross-env ESLINT_USE_FLAT_CONFIG=false eslint src tests --ext .js,.jsx,.ts,.tsx --cache && npm run lint:md && npm run changelog:validate",
"lint:md": "npm run lint:md:links && npm run lint:md:style",
"lint:md:links": "node scripts/lint-markdown-links.js",
</code_context>
<issue_to_address>
**suggestion:** Consider aligning `format:check` file set with `format` to avoid inconsistent formatting guarantees.
Currently `format` runs Prettier on `**/*.{js,jsx,ts,tsx,json,md,html,css}`, while `format:check` only checks `**/*.{json,md,html,css}`. This means CI only enforces formatting for non-code files and may miss JS/TS issues. If CI is meant to gate on all Prettier formatting, consider having `format:check` use the same glob (or a shared config) so JS/TS files don’t pass lint but later fail `npm run format` locally.
```suggestion
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,html,css}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md,html,css}\"",
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
There was a problem hiding this comment.
Code Review
This pull request adds a Prettier formatting check (format:check) to the lint script and a CI guard to ensure a clean working tree after linting. The changes are well-documented in cicd_security.md and tests/catalog.md. My review focuses on making the new format:check script more robust and consistent with the existing format script. I've suggested an improvement in package.json to ensure all relevant file types are checked for formatting.
|
Code Review by Qodo
1. Prettier checks generated CSS
|



Summary
Checking formatting...
All matched files use Prettier code style!
Markdown docs lint passed: 15 markdown files checked, 8 links/images scanned, no decorative icons found.
Changelog validation passed: CHANGELOG.md
Validation
Summary by Sourcery
Add a non-mutating Prettier formatting check to the lint pipeline and enforce a clean working tree in the QA CI workflow after lint completes.
New Features:
format:checknpm script for deterministic Prettier formatting verification without modifying files.Enhancements:
format:checkinto the mainnpm run lintcommand to make formatter drift detection part of the standard lint workflow.CI:
Documentation:
Summary by CodeRabbit