chore: add explicit permissions to gh workflows and update lints#126
chore: add explicit permissions to gh workflows and update lints#126
Conversation
- Add `contents: read` and `pull-requests: write` permissions to analyze workflow - Add `contents: read` permission to backup workflow - Add `contents: write` permission to publish workflow - Add `contents: read` permission to test workflow
- Enable shorthand preference rules that were previously disabled - Enable new metrics rules: avoid-missing-test-files, avoid-unassigned-local-variable, avoid-undisposed-instances, avoid-unnecessary-parentheses, prefer-non-nulls - Disable avoid-throw rule due to breaking change and use of maybe* methods - Update dart_code_metrics_presets to ^2.30.0 - Update test to ^1.31.0 - Update SDK constraint to ^3.11.3 - Fix RegExp instantiation to use shorthand syntax - Update example code to use maybeMapStatusCode with proper parameter handling
📝 WalkthroughWalkthroughAdded explicit GitHub Actions workflow permissions, adjusted Dart analysis rules and example SDK/dev dependency versions, refactored example status-code handling, changed a RegExp constructor call, and updated README and debug launch labels. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
=======================================
Coverage 99.57% 99.57%
=======================================
Files 3 3
Lines 1397 1397
=======================================
Hits 1391 1391
Misses 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish.yaml:
- Around line 15-17: Move the workflow-level "contents: write" permission out of
the top-level permissions block and instead grant "contents: write" only in the
"check-version" job that runs dev-drprasad/delete-tag-and-release@v1.1; leave
the rest of the workflow (including the "publish-dry-run" job that runs "dart
pub publish --dry-run") with no write permission (or only the minimal read
permissions it needs). Update the "check-version" job's permissions to include
"contents: write" and remove or tighten the global permissions entry so
workflow-wide write access is not granted.
In `@example/lib/main.dart`:
- Around line 130-136: The orElse callback currently returns response.statusCode
while receiving otherStatus; update the orElse body in the callback (the
anonymous function passed to orElse) to return the provided otherStatus
parameter instead of response.statusCode to be consistent with the parameter
naming and other branches (refer to the orElse anonymous function and the
otherStatus parameter).
In `@lib/src/status_code.dart`:
- Line 737: The regExp getter contains invalid syntax using `.new` without a
type; update the getter (static RegExp get regExp) to call the RegExp
constructor properly by replacing `.new(pattern, caseSensitive: false)` with
either the named constructor form `RegExp.new(pattern, caseSensitive: false)` or
the standard form `RegExp(pattern, caseSensitive: false)` so the getter returns
a valid RegExp instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7be992ef-05d8-46b1-b6ad-b9e7c71a410a
📒 Files selected for processing (10)
.github/workflows/analyze.yaml.github/workflows/backup.yaml.github/workflows/publish.yaml.github/workflows/test.yamlanalysis_options.yamlexample/analysis_options.yamlexample/lib/main.dartexample/pubspec.yamllib/src/status_code.dartpubspec.yaml
- Move `contents: write` permission from global to `check-version` job only - Reorder debug configurations in `.zed/debug.json` for consistency - Add GitHub issues badge to README - Update test count from 1000 to 1120 in documentation - Clarify industry adoption timeline (remove specific year reference) - Add verified publisher feature to README - Fix status code variable reference in example code
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
143-156: 🧹 Nitpick | 🔵 TrivialMake factual README claims source-backed or CI-derived to prevent drift.
Lines 143, 145, and 155 include time/count assertions (
1120 tests,for years,since 2022) that can become stale or disputed. Prefer linking each claim to a verifiable source (CI run, pub.dev publisher page, or adoption evidence) or reword to non-time-bound phrasing.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` around lines 143 - 156, Update the README claims to be source-backed or non-time-bound: for item "11. High code coverage" replace the hard count "1120 tests" with a link to the CI/codecov badge or phrase like "near 100% coverage (see CI badge)" and cite the test report; for item "12. Industry adopted" replace "for years" with either a link to adoption evidence (case studies/references) or reword to "used in production by several European companies"; for item "17. Verified publisher" replace "since 2022" with a link to the pub.dev publisher page or reword to "published under an active, verified pub.dev publisher account" so claims are verifiable and non-time-bound.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@README.md`:
- Around line 143-156: Update the README claims to be source-backed or
non-time-bound: for item "11. High code coverage" replace the hard count "1120
tests" with a link to the CI/codecov badge or phrase like "near 100% coverage
(see CI badge)" and cite the test report; for item "12. Industry adopted"
replace "for years" with either a link to adoption evidence (case
studies/references) or reword to "used in production by several European
companies"; for item "17. Verified publisher" replace "since 2022" with a link
to the pub.dev publisher page or reword to "published under an active, verified
pub.dev publisher account" so claims are verifiable and non-time-bound.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: ba411af1-c421-48d7-b645-ec9947db3443
📒 Files selected for processing (4)
.github/workflows/publish.yaml.zed/debug.jsonREADME.mdexample/lib/main.dart
Description
contents: readandpull-requests: writepermissions to analyzeworkflow
contents: readpermission to backup workflowcontents: writepermission to publish workflowcontents: readpermission to test workflow# Pull RequestType of Change
Summary by CodeRabbit
Chores
Documentation