Skip to content

Conversation

@christerswahn
Copy link
Collaborator

@christerswahn christerswahn commented Apr 28, 2025

This package specifies Dart SDK dependency of 3.3 or greater, but did not test it with Dart 3.3 in the CI pipeline. This PR fixes that.

Summary by CodeRabbit

  • Chores
    • Updated continuous integration workflow to test against multiple Dart SDK versions (3.3 and 3.6) for improved compatibility.
  • Style
    • Added analyzer directives to test files to suppress warnings and lint errors related to Dart 3.3 and unused variables.
  • Refactor
    • Optimized internal handling of configuration resolution for improved efficiency.

@coderabbitai
Copy link

coderabbitai bot commented Apr 28, 2025

Warning

Rate limit exceeded

@christerswahn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 02add8d and 8962f72.

📒 Files selected for processing (3)
  • lib/src/config/configuration.dart (5 hunks)
  • lib/src/config/option_groups.dart (2 hunks)
  • test/config/configuration_test.dart (3 hunks)
📝 Walkthrough

Walkthrough

The changes introduce multi-version Dart SDK testing in the GitHub Actions CI workflow by running formatting, analysis, and test jobs against both Dart 3.3 and 3.6. Several test files are updated with analyzer directives to suppress warnings related to Dart 3.3 compatibility and unused local variables. In the configuration logic, a return value is updated to use a compile-time constant for the "no value" case. No changes are made to public APIs or exported entities.

Changes

File(s) Change Summary
.github/workflows/ci.yml Updated CI workflow to test against Dart 3.3 and 3.6 using a matrix strategy for all jobs.
lib/src/config/configuration.dart Changed _doResolve to return a constant OptionResolution.noValue() instead of a new instance.
test/prompts/confirm_test.dart
test/prompts/input_test.dart
test/prompts/multiple_select_test.dart
test/prompts/select_test.dart
test/std_out_logger_test.dart
Added analyzer ignore directives for Dart 3.3 and unused local variables at the top of each test file.
test/test_utils/mock_stdout.dart Added ignore comments above lineTerminator to suppress Dart 3.3 and override-related lints.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Dart Setup Action
    participant Job (Format/Analyze/Test)

    GitHub Actions->>Job (Format/Analyze/Test): Start job with matrix (Dart 3.3, 3.6)
    Job (Format/Analyze/Test)->>Dart Setup Action: Setup Dart SDK ${{ matrix.dart }}
    Dart Setup Action-->>Job (Format/Analyze/Test): Dart SDK ready
    Job (Format/Analyze/Test)->>Job (Format/Analyze/Test): Run formatting, analysis, or tests
    Job (Format/Analyze/Test)-->>GitHub Actions: Report results for each Dart version
Loading

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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.

@christerswahn christerswahn force-pushed the config branch 2 times, most recently from a281fcd to 008e463 Compare April 28, 2025 13:40
@christerswahn christerswahn changed the title ci: Test with Dart 3.3 and 3.6 in CI pipeline ci: Run with Dart 3.3 and 3.6 in CI pipeline tests Apr 28, 2025
@christerswahn christerswahn marked this pull request as ready for review April 28, 2025 13:51
@christerswahn christerswahn requested a review from Isakdl April 28, 2025 13:51
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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

🧹 Nitpick comments (3)
.github/workflows/ci.yml (3)

22-22: Correct indentation for sdk: under with:

YAMLlint flags this line as mis-indented (16 vs. expected 18 spaces). Align it properly:

-                sdk: ${{ matrix.dart }}
+                  sdk: ${{ matrix.dart }}
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 22-22: wrong indentation: expected 18 but found 16

(indentation)


35-35: Correct indentation for sdk: under with:

Apply the same two-space indent fix here to satisfy YAMLlint.

-                sdk: ${{ matrix.dart }}
+                  sdk: ${{ matrix.dart }}
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 35-35: wrong indentation: expected 18 but found 16

(indentation)


48-48: Correct indentation for sdk: under with:

Repeat the two-space indent adjustment to clear the YAMLlint warning.

-                sdk: ${{ matrix.dart }}
+                  sdk: ${{ matrix.dart }}
🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 48-48: wrong indentation: expected 18 but found 16

(indentation)

🛑 Comments failed to post (4)
test/std_out_logger_test.dart (1)

1-1: ⚠️ Potential issue

Invalid ignore directive syntax
The comment // ignore required for Dart 3.3 is not recognized by the Dart analyzer. To suppress a lint related to required parameters under Dart 3.3, use a valid ignore_for_file: directive—for example:

// ignore_for_file: avoid_required_named_parameters
test/prompts/multiple_select_test.dart (1)

1-1: ⚠️ Potential issue

Invalid ignore directive syntax
The comment // ignore required for Dart 3.3 is not a valid Dart analyzer directive. Replace it with a proper ignore_for_file: directive to suppress the relevant lint, e.g.:

// ignore_for_file: avoid_required_named_parameters
test/prompts/confirm_test.dart (1)

1-1: ⚠️ Potential issue

Invalid ignore directive syntax
The comment // ignore required for Dart 3.3 will not be honored by the Dart analyzer. To suppress the lint for required parameters under Dart 3.3, use a valid ignore directive:

// ignore_for_file: avoid_required_named_parameters
test/prompts/select_test.dart (1)

1-1: ⚠️ Potential issue

Invalid ignore directive syntax
The // ignore required for Dart 3.3 comment is not a standard analyzer directive and will be ignored. Use the correct syntax to suppress the lint, e.g.:

// ignore_for_file: avoid_required_named_parameters

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

22-22: Consider fixing indentation for consistent YAML style.

While functionally correct, these lines are flagged by YAMLlint as having inconsistent indentation (16 spaces instead of 18).

-                sdk: ${{ matrix.dart }}
+                  sdk: ${{ matrix.dart }}

Also applies to: 35-35, 48-48

🧰 Tools
🪛 YAMLlint (1.35.1)

[warning] 22-22: wrong indentation: expected 18 but found 16

(indentation)

🛑 Comments failed to post (3)
test/config/configuration_test.dart (3)

1203-1273: ⚠️ Potential issue

Added comprehensive test case for mutually exclusive options with allowed defaults.

This new test group thoroughly verifies the behavior of mutually exclusive options where defaults are allowed, including validation of precedence and error conditions. However, it also depends on the undefined MutuallyExclusiveMode enum.

The test is logically complete but will fail compilation due to the undefined enum. The actual test cases show proper coverage of various scenarios including default value handling.

🧰 Tools
🪛 GitHub Actions: CLI Tools CI

[error] 1208-1208: The named parameter 'mode' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'mode'. (undefined_named_parameter)


[error] 1208-1208: Invalid constant value. (invalid_constant)


[error] 1208-1208: Undefined name 'MutuallyExclusiveMode'. Try correcting the name to one that is defined, or defining the name. (undefined_identifier)


1170-1201: ⚠️ Potential issue

New test group added for mutually exclusive mandatory options with default values.

The test validates appropriate error handling when mutually exclusive options are both mandatory and have default values, but it depends on the undefined MutuallyExclusiveMode enum.

The test is well-structured but will fail compilation due to the undefined enum reference. This needs to be fixed before the test can run properly.

🧰 Tools
🪛 GitHub Actions: CLI Tools CI

[error] 1175-1175: The named parameter 'mode' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'mode'. (undefined_named_parameter)


[error] 1175-1175: Invalid constant value. (invalid_constant)


[error] 1175-1175: Undefined name 'MutuallyExclusiveMode'. Try correcting the name to one that is defined, or defining the name. (undefined_identifier)


1057-1061: 💡 Verification agent

🧩 Analysis chain

Missing enum definition for MutuallyExclusiveMode.

The test is trying to use a MutuallyExclusiveMode.mandatory enum that isn't defined or imported, causing multiple compilation errors.


🏁 Script executed:

#!/bin/bash
# Let's check if MutuallyExclusiveMode is defined elsewhere in the codebase
echo "Searching for MutuallyExclusiveMode definition or usage"
rg "MutuallyExclusiveMode" --type dart

Length of output: 406


🏁 Script executed:

#!/bin/bash
echo "Searching for enum MutuallyExclusiveMode definition"
rg "enum MutuallyExclusiveMode" -n --type dart

echo
echo "Searching for class MutuallyExclusive definition"
rg "class MutuallyExclusive" -n --type dart

echo
echo "Printing the first 40 lines of test/config/configuration_test.dart to inspect imports"
sed -n '1,40p' test/config/configuration_test.dart

Length of output: 1889


🏁 Script executed:

#!/bin/bash
echo "Displaying the beginning of lib/src/config/option_groups.dart to inspect MutuallyExclusive and related definitions"
sed -n '1,200p' lib/src/config/option_groups.dart

Length of output: 1507


Update MutuallyExclusive tests to use named boolean parameters

The MutuallyExclusive constructor doesn’t accept a mode enum; it uses mandatory and allowDefaults named bool parameters. Update the tests accordingly:

• File: test/config/configuration_test.dart
Lines: ~1057–1061

Suggested diff:

-group('Given two options that are mutually exclusive, mandatory,', () {
-  const group = MutuallyExclusive(
-    'mutex-group',
-    mode: MutuallyExclusiveMode.mandatory,
-  );
+group('Given two options that are mutually exclusive, mandatory,', () {
+  const group = MutuallyExclusive(
+    'mutex-group',
+    mandatory: true,
+  );

And for tests using MutuallyExclusiveMode.allowDefaults, replace:

-  mode: MutuallyExclusiveMode.allowDefaults,
+  allowDefaults: true,
📝 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.

  group('Given two options that are mutually exclusive, mandatory,', () {
    const group = MutuallyExclusive(
      'mutex-group',
      mandatory: true,
    );
🧰 Tools
🪛 GitHub Actions: CLI Tools CI

[error] 1060-1060: The named parameter 'mode' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'mode'. (undefined_named_parameter)


[error] 1060-1060: Invalid constant value. (invalid_constant)


[error] 1060-1060: Undefined name 'MutuallyExclusiveMode'. Try correcting the name to one that is defined, or defining the name. (undefined_identifier)

Copy link
Contributor

@Isakdl Isakdl left a comment

Choose a reason for hiding this comment

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

LGTM

@christerswahn christerswahn merged commit 73965d3 into main Apr 28, 2025
16 checks passed
@christerswahn christerswahn deleted the config branch April 28, 2025 14:06
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.

3 participants