Skip to content

Migrate data source from rules.json to messages.yaml #9

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

Merged
merged 74 commits into from
Apr 23, 2025

Conversation

r0227n
Copy link
Contributor

@r0227n r0227n commented Mar 19, 2025

Issue

Overview (Required)

This pull request includes several changes to the tools/update_lint_rules package, focusing on updating the LintRule model, adding a new JSON converter for State, and modifying the AnalysisOptionsService to use the new State type. The most important changes include the introduction of the State type, the addition of new methods to the RuleState enum, and the updates to the AnalysisOptionsService to filter rules based on the new State type.

Updates to LintRule model:

  • Added nullable fields for categories and details, and replaced RuleState with the new State type in the Rule factory constructor.
  • Introduced the State type as a typedef for Map<RuleState, Since> and added the _StateJsonConverter class to handle JSON serialization and deserialization for the State type.

Enhancements to RuleState enum:

  • Added internal state to the RuleState enum.
  • Introduced active and inactive getter methods to determine the activity status of a rule state.

Changes to AnalysisOptionsService:

  • Added an extension method hasSupportedVersion to the State type to check if a rule state meets a minimum Dart SDK version.
  • Updated the filtering logic in AnalysisOptionsService to use the new State type and its hasSupportedVersion method.

Codebase simplification:

  • Removed unnecessary fields and methods related to description, incompatibles, sets, fixStatus, and since from the Rule class and its related classes and methods.
  • Updated the JSON serialization and deserialization logic in lint_rule.g.dart to reflect the changes in the Rule class.

Links

Screenshot

N/A

Copy link
Contributor

Ready for review 🚀

Copy link
Member

@blendthink blendthink left a comment

Choose a reason for hiding this comment

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

@r0227n
I've left some comments, so please take a look. 🙏

@r0227n
Copy link
Contributor Author

r0227n commented Mar 21, 2025

@blendthink
Please re-review.
When comparing 3.6/all.yaml before and after the fix, package_api_docs and unsafe_html_attribute are

  • Before: not included
  • After modification: included

but we are aware that this is not a problem.


package_api_docs

Before: rules.json

https://github.com/dart-lang/sdk/blob/ae6da8b926f208bf87d2e11375be5c611c27ee1b/pkg/linter/tool/machine/rules.json#L1625-L1638
The value of state key was not output before the correction because it was removed.

After: message.yaml

https://github.com/dart-lang/sdk/blob/ae6da8b926f208bf87d2e11375be5c611c27ee1b/pkg/linter/messages.yaml#L7394-L7399

Because “removed” is 3.7 or later, it is now output in 3.6.


unsafe_html

Before modification: rules.json

Not output because it is not described in the rules.json.

After: message.yaml

https://github.com/dart-lang/sdk/blob/ae6da8b926f208bf87d2e11375be5c611c27ee1b/pkg/linter/messages.yaml#L13330-L13336

The output is output because it is described.

@r0227n
Copy link
Contributor Author

r0227n commented Apr 2, 2025

@blendthink
Please re-review.🙇

r0227n and others added 19 commits April 10, 2025 12:33
Rename sourceRuleWithCategories to ruleWithCategories to make the code
more concise while maintaining clarity about the variable's role in
handling shared rule categories.
@r0227n
Copy link
Contributor Author

r0227n commented Apr 16, 2025

@blendthink
Please re-review.🙇

Copy link
Member

@blendthink blendthink left a comment

Choose a reason for hiding this comment

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

@r0227n
Please take a look and leave your comments or make any necessary changes.

@r0227n
Copy link
Contributor Author

r0227n commented Apr 18, 2025

@blendthink
Please re-review.🙇


https://github.com/yumemi-inc/flutter-yumemi-lints/pull/163/files

This is the latest diff as of 9ed9b39.
We would appreciate it if you could check it at the time of review.

@r0227n
Copy link
Contributor Author

r0227n commented Apr 22, 2025

@blendthink
Added to CHANGELOG.md, “Reflect Status” and “remove incompatibles”.
Please re-review🙇

Copy link
Member

@blendthink blendthink left a comment

Choose a reason for hiding this comment

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

LGTM!

@blendthink blendthink enabled auto-merge April 23, 2025 07:39
@blendthink blendthink added this pull request to the merge queue Apr 23, 2025
Merged via the queue into main with commit 6fc2438 Apr 23, 2025
1 check passed
@blendthink blendthink deleted the improve/update-source-rules branch April 23, 2025 07:40
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.

[Improve]: Migrate rules.json to messages.yaml

None yet

2 participants