Skip to content

feat: update VGA for Dart v3.8.0 #152

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

wolfenrain
Copy link
Member

@wolfenrain wolfenrain commented May 26, 2025

Status

READY

Description

Getting ready for v3.8 of Dart. This also includes @spydon's changes from #151 (that I stole with his permission)

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
  • 📝 Documentation
  • 🗑️ Chore

Summary by CodeRabbit

  • Chores

    • Updated Dart SDK version requirement to 3.8.0 across project and tooling.
    • Updated analysis options to use the latest linting rules and stricter code analysis.
    • Removed references to deprecated or unnecessary linter rules from documentation and configuration files.
    • Added a new analysis options configuration file with enhanced linting and formatting rules.
  • Documentation

    • Updated README to reflect changes in excluded lint rules.

@wolfenrain wolfenrain requested a review from a team as a code owner May 26, 2025 16:00
Copy link

coderabbitai bot commented May 26, 2025

Walkthrough

The changes update Dart SDK constraints to 3.8.0 in multiple configuration files, upgrade the analysis options to use very_good_analysis 9.0.0, and add a new strict analysis configuration file. Additionally, two linter rules are removed from exclusion lists in documentation and configuration files.

Changes

File(s) Change Summary
.github/workflows/tool_linter_rules.yaml
pubspec.yaml
tool/linter_rules/pubspec.yaml
Updated Dart SDK version constraint from 3.7.0 to 3.8.0.
lib/analysis_options.yaml Updated included analysis options from very_good_analysis 8.0.0 to 9.0.0.
lib/analysis_options.9.0.0.yaml Added new strict analysis options file with comprehensive linting and analyzer rules.
README.md
tool/linter_rules/exclusion_reasons.json
Removed "switch_on_type" and "unnecessary_unawaited" linter rules from exclusion lists.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Analyzer
    participant Linter

    Developer->>Analyzer: Trigger analysis (now uses very_good_analysis 9.0.0)
    Analyzer->>Linter: Apply updated rules (from analysis_options.9.0.0.yaml)
    Linter-->>Analyzer: Report results (with stricter and updated rule set)
    Analyzer-->>Developer: Output analysis/lint results
Loading

Poem

🐇
Hopping to Dart 3.8,
With lints both strict and great!
Old rules now swept away,
Fresh analysis leads the way.
Commas trailing, code refined,
In this garden, bugs are left behind!


📜 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 ce61571 and 7d79095.

📒 Files selected for processing (1)
  • .github/workflows/tool_linter_rules.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/tool_linter_rules.yaml

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.

@wolfenrain wolfenrain mentioned this pull request May 26, 2025
7 tasks
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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cb79f4c and ce61571.

📒 Files selected for processing (7)
  • .github/workflows/tool_linter_rules.yaml (1 hunks)
  • README.md (0 hunks)
  • lib/analysis_options.9.0.0.yaml (1 hunks)
  • lib/analysis_options.yaml (1 hunks)
  • pubspec.yaml (1 hunks)
  • tool/linter_rules/exclusion_reasons.json (0 hunks)
  • tool/linter_rules/pubspec.yaml (1 hunks)
💤 Files with no reviewable changes (2)
  • tool/linter_rules/exclusion_reasons.json
  • README.md
🧰 Additional context used
🪛 GitHub Actions: ci
lib/analysis_options.yaml

[warning] 1-1: 'switch_on_type' is not a recognized lint rule in the included options file.


[warning] 1-1: 'unnecessary_unawaited' is not a recognized lint rule in the included options file.

🔇 Additional comments (5)
pubspec.yaml (1)

10-12: Align Dart SDK constraint
Updated the SDK constraint to ^3.8.0, which aligns with the PR objective and is consistent with other tool and CI configurations.

.github/workflows/tool_linter_rules.yaml (1)

17-21: Update CI Dart version
The GitHub Actions workflow’s Dart setup step now uses sdk: 3.8.0, matching the root and tool SDK constraints.

tool/linter_rules/pubspec.yaml (1)

6-8: Sync tool SDK environment
The linter_rules tool’s pubspec.yaml now specifies sdk: ^3.8.0, maintaining consistency across the repo.

lib/analysis_options.yaml (1)

1-2: Reference new analysis options
This file now includes analysis_options.9.0.0.yaml (v9.0.0). Pipeline warnings indicate unrecognized rules (e.g., switch_on_type, unnecessary_unawaited). Please verify that the included file defines these rules correctly and that their names match the official lint rule names.

🧰 Tools
🪛 GitHub Actions: ci

[warning] 1-1: 'switch_on_type' is not a recognized lint rule in the included options file.


[warning] 1-1: 'unnecessary_unawaited' is not a recognized lint rule in the included options file.

lib/analysis_options.9.0.0.yaml (1)

197-197:

❌ Incorrect review comment

Unrecognized lint rule: unnecessary_unawaited
The analyzer flags unnecessary_unawaited as invalid—consider replacing it with the correct rule (unawaited_futures?) or removing it to clear CI errors.


To verify whether unnecessary_unawaited is actually defined in your analysis options file, let’s inspect the rules around line 197:


🏁 Script executed:

#!/usr/bin/env bash
# Locate the analysis options file
file=$(fd -t f analysis_options.9.0.0.yaml | head -n 1)
echo "Inspecting: $file"
# Show context around the reported line
sed -n '180,220p' "$file"

Length of output: 1540


🌐 Web query:

Is 'unnecessary_unawaited' a valid Dart lint rule?

💡 Result:

Yes, unnecessary_unawaited is a valid Dart lint rule.

This rule flags unnecessary uses of the unawaited() function when calling an asynchronous method or function that is annotated with @awaitNotRequired. When such a method is annotated this way, wrapping it with unawaited() is redundant and should be avoided.

Example from official documentation:

  • BAD:

    @awaitNotRequired
    Future<LogMessage> log(String message) { ... }
    
    void f() {
      unawaited(log('Message.'));
    }
  • GOOD:

    @awaitNotRequired
    Future<LogMessage> log(String message) { ... }
    
    void f() {
      log('Message.');
    }

How to enable:

To enable this rule, add it to your analysis_options.yaml file under linter > rules:

linter:
  rules:
    - unnecessary_unawaited

or using map syntax:

linter:
  rules:
    unnecessary_unawaited: true

The official documentation confirms that unnecessary_unawaited is available in Dart as of version 3.8.0 and provides clear guidelines on its use and configuration[7].

Citations:


Incorrect lint rule warning – unnecessary_unawaited is valid
The rule unnecessary_unawaited has been part of the Dart linter since version 3.8.0 and is correctly listed in your analysis_options.yaml. The CI errors you’re seeing are likely due to an older SDK or linter package that doesn’t yet include this rule. No change is needed in your rules list—please upgrade your Dart analyzer/linter in CI to a version that supports unnecessary_unawaited.

Likely an incorrect or invalid review comment.

- sort_unnamed_constructors_first
- specify_nonobvious_property_types
- strict_top_level_inference
- switch_on_type
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Unrecognized lint rule: switch_on_type
CI reports switch_on_type as unrecognized. Confirm this rule exists in Dart’s linter or the v9.0.0 analysis package; otherwise, remove or correct it to resolve the warning.


🌐 Web query:

Does Dart’s official linter include a `switch_on_type` rule?

💡 Result:

As of Dart 3.0, the official Dart linter includes a rule named avoid_switch_on_runtimeType. This rule advises against using switch statements on an object's runtimeType, recommending instead the use of type checks with pattern-matching expressions like String _ or int(). The rationale is that switching on runtimeType can lead to code that is prone to breaking when class hierarchies change or new types are added, and it doesn't take full advantage of Dart’s strong static typing system. (github.com)

To enable this rule, add avoid_switch_on_runtimeType under the linter > rules section in your analysis_options.yaml file:

linter:
  rules:
    - avoid_switch_on_runtimeType

This configuration will activate the lint, helping you identify and refactor instances where switch statements are used on runtimeType, thereby promoting more maintainable and type-safe code.

Citations:


Replace unrecognized switch_on_type rule with avoid_switch_on_runtimeType

The Dart linter does not include a switch_on_type rule. To enforce avoiding switches on an object’s runtimeType, use the built-in avoid_switch_on_runtimeType rule instead.

• lib/analysis_options.9.0.0.yaml:165

-   - switch_on_type
+   - avoid_switch_on_runtimeType
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- switch_on_type
- avoid_switch_on_runtimeType
🤖 Prompt for AI Agents
In lib/analysis_options.9.0.0.yaml at line 165, the lint rule `switch_on_type`
is unrecognized by Dart’s linter. Replace `switch_on_type` with the correct rule
name `avoid_switch_on_runtimeType` under the `linter > rules` section to enable
the intended lint check and remove the CI warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant