feat!: Only pass line-length to format if a value is provided#330
feat!: Only pass line-length to format if a value is provided#330wolfenrain merged 5 commits intoVeryGoodOpenSource:mainfrom
Conversation
WalkthroughThe changes remove the default value for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Workflow
participant DartFormatter
User->>Workflow: Trigger workflow (optionally sets format_line_length)
Workflow->>Workflow: Check if format_line_length is provided
alt format_line_length is provided
Workflow->>DartFormatter: Run dart format with --line-length=<value>
else format_line_length is not provided
Workflow->>DartFormatter: Run dart format without --line-length
end
Assessment against linked issues
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit 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. 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/workflows/dart_package.yml (2)
26-28: Enforce numeric input for line length
Sinceformat_line_lengthrepresents an integer, changing its type tonumberwill validate user input at the workflow boundary and catch non-numeric values early.Apply this diff:
- format_line_length: - required: false - type: string + format_line_length: + required: false + type: number
102-102: Tighten conditional flag inclusion
The current expression includes--line-lengthwhenformat_line_lengthis truthy, but may still pass unintended values. For more precise control, explicitly check for a non-empty string and update the step:- run: dart format ${{inputs.format_line_length && format('--line-length {0}', inputs.format_line_length) || ''}} --set-exit-if-changed ${{inputs.format_directories}} + run: dart format ${{ inputs.format_line_length != '' && format('--line-length {0}', inputs.format_line_length) || '' }} --set-exit-if-changed ${{ inputs.format_directories }}.github/workflows/flutter_package.yml (1)
30-32: Use a numeric type for line length
Aligning with the Dart workflow, enforceformat_line_lengthas anumberto ensure only valid integers are provided:- format_line_length: - required: false - type: string + format_line_length: + required: false + type: number
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/dart_package.yml(1 hunks).github/workflows/flutter_package.yml(1 hunks)site/docs/workflows/dart_package.md(0 hunks)site/docs/workflows/flutter_package.md(0 hunks)
💤 Files with no reviewable changes (2)
- site/docs/workflows/flutter_package.md
- site/docs/workflows/dart_package.md
🔇 Additional comments (1)
.github/workflows/flutter_package.yml (1)
103-103: Verify formatting command in both cases
The conditional flag logic is correct. Please test the workflow with and withoutformat_line_lengthto confirm no malformed command (e.g., extra spaces) occurs at runtime.
Migration Details
Since Dart 3.7 the line length can be configured in the
analysis_options, henceformat_line_lengthhas now been made optional and has no explicit workflow default.When using a Dart version lower than 3.7, to keep using the default line length value of
80on the format checking step, be sure to explicitly pass it on theformat_line_lengthattribute, for example:Status
READY
Description
Only pass a value for the
line_lengthflag in thedart formatcommand if the user explicitly passed a value to it.Fixes #329
Type of Change