Skip to content

fix: Change AnalysisRule from Warning to Lint#120

Merged
riscait merged 1 commit intomainfrom
change-analysis-rule-from-warning-to-lint
Dec 5, 2025
Merged

fix: Change AnalysisRule from Warning to Lint#120
riscait merged 1 commit intomainfrom
change-analysis-rule-from-warning-to-lint

Conversation

@riscait
Copy link
Member

@riscait riscait commented Dec 5, 2025

closes #85

🙌 What's Done

  • Replace from registerWarningRule to registerLintRule
  • Enable lint rules in packages/altive_lints/lib/altive_lints.yaml
  • altive_lints v2.0.0-dev.2

Pre-launch Checklist

  • I have reviewed my own code (e.g., updated tests and documentation)

@riscait riscait self-assigned this Dec 5, 2025
@riscait riscait requested a review from a team as a code owner December 5, 2025 08:27
@riscait riscait requested review from Aimiee01 and naipaka and removed request for a team December 5, 2025 08:27
@gemini-code-assist
Copy link

Summary of Changes

Hello @riscait, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the integration of custom analysis rules within the altive_lints package by transitioning them from warning-based registrations to proper lint rule registrations. This change ensures that these custom rules are treated as first-class lints by the Dart analyzer, improving consistency and configurability. Additionally, the update includes explicit activation of these rules in the package's configuration and a version bump.

Highlights

  • Rule Registration Type Change: All custom analysis rules within the altive_lints package have been re-registered from registerWarningRule to registerLintRule, aligning them more closely with standard linting practices.
  • Lint Rule Activation: The altive_lints.yaml configuration file has been updated to explicitly enable all custom lint rules under a new diagnostics section.
  • Version Bump: The package version for altive_lints has been incremented from 2.0.0-dev.1 to 2.0.0-dev.2.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly changes the custom analysis rules from Warning to Lint rules, which allows them to be configured like standard linter rules. The changes are consistent across all files: the registration method is updated in main.dart, the rules are enabled by default in altive_lints.yaml, and documentation and versioning are updated accordingly.

I have one suggestion in main.dart to improve the maintainability of the rule registration code by reducing repetition. Overall, this is a solid improvement for the package.

Comment on lines +29 to +37
..registerLintRule(AvoidConsecutiveSliverToBoxAdapter())
..registerLintRule(AvoidHardcodedColor())
..registerLintRule(AvoidHardcodedJapanese())
..registerLintRule(AvoidShrinkWrapInListView())
..registerLintRule(AvoidSingleChild())
..registerLintRule(PreferClockNow())
..registerLintRule(PreferDedicatedMediaQueryMethods())
..registerLintRule(PreferSpaceBetweenElements())
..registerLintRule(PreferToIncludeSliverInName())

Choose a reason for hiding this comment

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

medium

To improve maintainability, consider grouping these rule registrations. You can define a list of rules and iterate over it to register them. This makes adding or removing rules cleaner.

For example:

final lintRules = <AnalysisRule>[
  AvoidConsecutiveSliverToBoxAdapter(),
  AvoidHardcodedColor(),
  AvoidHardcodedJapanese(),
  AvoidShrinkWrapInListView(),
  AvoidSingleChild(),
  PreferClockNow(),
  PreferDedicatedMediaQueryMethods(),
  PreferSpaceBetweenElements(),
  PreferToIncludeSliverInName(),
];

for (final rule in lintRules) {
  registry.registerLintRule(rule);
}

This would replace the current chain of registerLintRule calls.

Copy link
Member Author

@riscait riscait Dec 5, 2025

Choose a reason for hiding this comment

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

@gemini-code-assist
How about this?

    <AnalysisRule>[
      AvoidConsecutiveSliverToBoxAdapter(),
      AvoidHardcodedColor(),
      AvoidHardcodedJapanese(),
      AvoidShrinkWrapInListView(),
      AvoidSingleChild(),
      PreferClockNow(),
      PreferDedicatedMediaQueryMethods(),
      PreferSpaceBetweenElements(),
      PreferToIncludeSliverInName(),
    ].forEach(registry.registerLintRule);

Copy link
Contributor

@naipaka naipaka left a comment

Choose a reason for hiding this comment

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

LGTM

@riscait riscait merged commit 1a7955e into main Dec 5, 2025
1 check passed
@riscait riscait deleted the change-analysis-rule-from-warning-to-lint branch December 5, 2025 10:19
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.

Migrate from custom_lint to the New Analyzer Plugin System

2 participants