Skip to content
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

Use positional arguments instead of manual string interpolation #434

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

PiotrRogulski
Copy link
Member

This PR is purely technical and does not introduce any behavior changes.

Refactors lint codes to use built-in positional parameters (like {0}) in lint messages.

@github-actions github-actions bot added the p: leancode_lint Related to the leancode_lint package label Feb 16, 2025
@PiotrRogulski PiotrRogulski requested a review from mchudy February 16, 2025 20:20
@shilangyu
Copy link
Contributor

Personally, I am not convinced to the benefits. This makes it much more susceptible to refactors. It is very easy to desync arguments: and {n} placeholders.

Yes, it is nice that it is built in. But Dart APIs are known to be designed in a pragmatic (???) rather than type safe way. We can build a small type safe wrapper?

@PiotrRogulski
Copy link
Member Author

Personally, I am not convinced to the benefits. This makes it much more susceptible to refactors. It is very easy to desync arguments: and {n} placeholders.

Yes, it is nice that it is built in. But Dart APIs are known to be designed in a pragmatic (???) rather than type safe way. We can build a small type safe wrapper?

It is indeed unfortunate that the analyzer only accepts positional arguments. The main benefit is that we define the lints the way they're supposed to be defined. In particular, after this refactor, we create only one LintCode with the template string – this way, it's actually easier to keep the messages consistent, in my opinion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: leancode_lint Related to the leancode_lint package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants