-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
Ready for review 🚀 |
There was a problem hiding this 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. 🙏
tools/update_lint_rules/lib/src/services/lint_rule_service.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/services/lint_rule_service.dart
Outdated
Show resolved
Hide resolved
@blendthink
but we are aware that this is not a problem. package_api_docsBefore: rules.jsonhttps://github.com/dart-lang/sdk/blob/ae6da8b926f208bf87d2e11375be5c611c27ee1b/pkg/linter/tool/machine/rules.json#L1625-L1638 After: message.yamlBecause “removed” is 3.7 or later, it is now output in 3.6. unsafe_htmlBefore modification: rules.jsonNot output because it is not described in the rules.json. After: message.yamlThe output is output because it is described. |
@blendthink |
… to JSON conversion process
…rule retrieval process
…ML to JSON within LintRuleService
Rename sourceRuleWithCategories to ruleWithCategories to make the code more concise while maintaining clarity about the variable's role in handling shared rule categories.
…dName and merge data after encoding.
@blendthink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r0227n
Apologies for the delayed review comment.
Please take a look and leave your comments or make any necessary changes.
tools/update_lint_rules/lib/src/services/lint_rule_service.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/services/analysis_options_service.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
/// Filter [LintCodeDto] by sharedName | ||
static Iterable<LintCodeDto> filterLintCodeDtosBySharedName( | ||
Iterable<LintCodeDto> dtos, | ||
) { | ||
return dtos.where( | ||
(dto) => | ||
dto.sharedName == null && | ||
dto.categories != null && | ||
dto.deprecatedDetails != null && | ||
dto.state != null, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always_require_non_null_named_parameters has only state
and deprecatedDetails
, so executing toRule
will result in a FormatException
.
Therefore, null safety
(e.g details ?? initialValue) or add it to the where
condition to exclude it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There exist values such as iterable_contains_unrelated_type's where state is not null but categories and deprecatedDetails are null.
Therefore, we changed c8191bc to filter sharedName as null and state as not null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mistake.
I deleted state in 7d0b4f9 because the conditions sharedName == null
and state != null
do not exist.
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
- Remove null-check conditions from where clause when grouping DTOs by sharedName - Allow toRuleFromDtos to handle cases where categories, deprecatedDetails, or state fields are partially missing across grouped DTOs - This ensures proper merging of data from multiple DTOs with the same sharedName
… other than state
I confirmed that always_require_non_null_named_parameters is successfully filtered by state by performing the following check because the state has ”removed“: ‘3.3’. The value of
|
@blendthink |
There was a problem hiding this 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.
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
tools/update_lint_rules/lib/src/mappers/lint_code_dto_mapper.dart
Outdated
Show resolved
Hide resolved
…exist, so state is deleted.
…e class instead of dto class
.map( | ||
(dto) => LintCodeDtoMapper.buildRule( | ||
name: dto.name, | ||
categories: dto.categories ?? const [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since data such as always_require_non_null_named_parameters's for which category
is null already exists, an empty character is assigned when category
is null.
@blendthink |
Issue
Overview (Required)
This pull request includes several changes to the
tools/update_lint_rules
package, focusing on updating theLintRule
model, adding a new JSON converter forState
, and modifying theAnalysisOptionsService
to use the newState
type. The most important changes include the introduction of theState
type, the addition of new methods to theRuleState
enum, and the updates to theAnalysisOptionsService
to filter rules based on the newState
type.Updates to
LintRule
model:categories
anddetails
, and replacedRuleState
with the newState
type in theRule
factory constructor. (tools/update_lint_rules/lib/src/models/lint_rule.dart
, tools/update_lint_rules/lib/src/models/lint_rule.dartL24-R25)State
type as a typedef forMap<RuleState, Since>
and added the_StateJsonConverter
class to handle JSON serialization and deserialization for theState
type. (tools/update_lint_rules/lib/src/models/lint_rule.dart
, tools/update_lint_rules/lib/src/models/lint_rule.dartR104-R119)Enhancements to
RuleState
enum:internal
state to theRuleState
enum.active
andinactive
getter methods to determine the activity status of a rule state. (tools/update_lint_rules/lib/src/models/lint_rule.dart
, tools/update_lint_rules/lib/src/models/lint_rule.dartR38-R45)Changes to
AnalysisOptionsService
:hasMinimumVersion
to theState
type to check if a rule state meets a minimum Dart SDK version. (tools/update_lint_rules/lib/src/services/analysis_options_service.dart
, tools/update_lint_rules/lib/src/services/analysis_options_service.dartR15-R31)AnalysisOptionsService
to use the newState
type and itshasMinimumVersion
method. (tools/update_lint_rules/lib/src/services/analysis_options_service.dart
, tools/update_lint_rules/lib/src/services/analysis_options_service.dartL37-R64)Codebase simplification:
description
,incompatibles
,sets
,fixStatus
, andsince
from theRule
class and its related classes and methods. (tools/update_lint_rules/lib/src/models/lint_rule.freezed.dart
, [1] [2] [3] [4] [5] [6] [7] [8]lint_rule.g.dart
to reflect the changes in theRule
class. (tools/update_lint_rules/lib/src/models/lint_rule.g.dart
, tools/update_lint_rules/lib/src/models/lint_rule.g.dartL17-R50)Links
Screenshot
N/A