-
Notifications
You must be signed in to change notification settings - Fork 266
[Question] What do you think of the ability for developers to add Custom Rules? #424
Comments
@hisaichi5518 to give a detailed response here I think we need more details about the expected API, so could you share your thoughts about that? Also, could you share a link to configuration you're talking about? |
@incendial The The features I expect to see are as follows
The API for
However, I am not familiar with analyzer_plugin, so I am not sure if the above API can be implemented. |
@hisaichi5518 okay, I think that I understand your question better now, thanks! Here is my point of view:
Summarizing all the points above: it'll increase the complexity a lot (and the most impact will be visible on a long distance), but the pros are questionable at least on a current stage of the package. And if you have an example of a rule that you want to implement using this API, could you share it? Because I don't really understand the type of rules that can't be added to the linter or to this package and need this API instead. |
@incendial The rules I want to make are as follows.
I don't think it should be included in the Dart Code Metrics as it is just a rule I want for me and not a rule that others should use. |
@hisaichi5518 thanks for sharing the list! First one looks very generic and probably can be useful for a broader audience, so if you could create a proposal with a detailed description (ex. #332 or #364) we'll implement it. The proposal will help us tweak the rule behaviour and configuration. Second one we already have, it's called avoid-returning-widgets. As for third one, yeah, this one looks pretty local and unfortunately we can't add it, sorry. And the last one is not that clear to me. If you could provide more details or formal criteria how side effects should be detected, then we can get a clear understanding on can it be useful for a broader audience or not. |
Side effect refers to the process of calling the API, etc. It can be difficult to set up rules without relying on application code. |
If I want to set my own lint rule for my library or my app, I need to create my own analyzer_plugin. I am using dart-code-metrics and I want to achieve that only with dart-code-metrics.
So I would like to ask what you think about adding a setting to dart-code-metrics for developers to set their own rules for their libraries and apps.
For example, you may want to set up a custom rule as shown below.
This has been inspired by the build_runner configuration.
The text was updated successfully, but these errors were encountered: