Skip to content

chore: add explicit permissions to gh workflows and update lints#126

Merged
tsinis merged 3 commits intomainfrom
chore/new-dcm-lints
Mar 19, 2026
Merged

chore: add explicit permissions to gh workflows and update lints#126
tsinis merged 3 commits intomainfrom
chore/new-dcm-lints

Conversation

@tsinis
Copy link
Copy Markdown
Owner

@tsinis tsinis commented Mar 19, 2026

Description

  • 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# Pull Request
  • Update DCM rules

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 🧪 Tests
  • 📝 Documentation
  • ⚙️ CI/CD or GitHub Workflow configuration change
  • 📦 Dependencies update

Summary by CodeRabbit

  • Chores

    • Updated CI workflow permissions and debug profiles for clearer, more restricted automation.
    • Bumped dev dependencies (Dart SDK, test, code-metrics) and adjusted tooling configs for stricter linting.
  • Documentation

    • Updated README (badge, test count, wording) and improved example code to show clearer status-code handling and error detection patterns.

tsinis added 2 commits March 19, 2026 22:22
- 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
github-actions[bot]
github-actions bot previously approved these changes Mar 19, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 19, 2026

📝 Walkthrough

Walkthrough

Added 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

Cohort / File(s) Summary
GitHub Actions workflows
.github/workflows/analyze.yaml, .github/workflows/backup.yaml, .github/workflows/publish.yaml, .github/workflows/test.yaml
Added explicit permissions blocks: workflows now set contents: read (most) and contents: write for the publish job.
Dart analysis config
analysis_options.yaml, example/analysis_options.yaml
Reorganized dart_code_metrics rules: enabled several new rules and shorthand preferences, removed prior explicit disables, and fixed trailing newline.
Example app & deps
example/lib/main.dart, example/pubspec.yaml
Refactored status-code handling to use maybeMapStatusCode with typed branches and added client-error/429 handling; bumped Dart SDK and dev dependency versions.
Library implementation
lib/src/status_code.dart
Changed RegExp construction to use explicit .new(pattern, caseSensitive: false) syntax.
Project metadata & docs
pubspec.yaml, .zed/debug.json, README.md
Bumped dev dependency versions, swapped debug launch labels/args, and updated README badges/feature text.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • github-actions
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding explicit permissions to GitHub workflows and updating linting rules (DCM).
Description check ✅ Passed The description covers the main changes with specific workflow permission additions, DCM rule updates, and appropriate type-of-change selections matching the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.57%. Comparing base (ec80c1e) to head (6409495).
⚠️ Report is 1 commits behind head on main.

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.
📢 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.

@coderabbitai coderabbitai bot added enhancement New feature or request D-5 labels Mar 19, 2026
Copy link
Copy Markdown
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.

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.

👉 Steps to fix this

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

📥 Commits

Reviewing files that changed from the base of the PR and between ec80c1e and ff718f2.

📒 Files selected for processing (10)
  • .github/workflows/analyze.yaml
  • .github/workflows/backup.yaml
  • .github/workflows/publish.yaml
  • .github/workflows/test.yaml
  • analysis_options.yaml
  • example/analysis_options.yaml
  • example/lib/main.dart
  • example/pubspec.yaml
  • lib/src/status_code.dart
  • pubspec.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
@coderabbitai coderabbitai bot added the documentation Improvements or additions to documentation label Mar 19, 2026
Copy link
Copy Markdown
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.

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 | 🔵 Trivial

Make 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

📥 Commits

Reviewing files that changed from the base of the PR and between ff718f2 and 6409495.

📒 Files selected for processing (4)
  • .github/workflows/publish.yaml
  • .zed/debug.json
  • README.md
  • example/lib/main.dart

@tsinis tsinis merged commit bd55851 into main Mar 19, 2026
11 checks passed
@tsinis tsinis deleted the chore/new-dcm-lints branch March 19, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore D-3 D-5 dependencies documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant