-
Notifications
You must be signed in to change notification settings - Fork 160
Packages with formatting issues should not have reduced score #2322
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
Comments
I think code readability is an important aspect of a library. When you import a third-party lib, you trust its developer, but also want to keep your options open: if you need to, you would like to dig into the source code, interpret it, and if needed, fix it. Code style (whether it is You are free to use your own preferred style, you can publish your package, and people can use it - there is no blocking in it. However, pub site will check against a common set of standards that the Dart team thought to be good conventions, and will expose it as part of the package score. Pub site aims to provide a consistent quality score that factors in everything, helping users to decide to choose using a package. By checking against this common set of standards users of a package can at least have some expectation against code quality, before even looking at the source code itself. If you think that some convention is not right, please raise an issue against |
Afaik the set of lints in It's also possible that in some future we could support custom linter rules.. But honestly, I hope the community creates a reasonable set of linter rules that everybody can use. Look at golang, everything is consistently formatted. This has a lot of value, personally, I'm not a fan of everything dartfmt does, but I think that following it far out weights the pain. |
Just to be clear: For now I think it's best if we stick to what we have, and keep it simple. |
My use case: I don't follow all Dart style conventions because I don't like some. But I always apply The issue: Personally (and at my work, 2/3 of the developers also think that), if an if (condition) doSomething(); ... than: if (condition) {
doSomething();
}
// or worst: if (condition) { doSomething(); } I don't intend to change my code just for stylistic reasons. And @munificent (the lead maintainer of dart-lang/dart_style#578 |
Hopefully it's a small penalty.. I haven't tried it, but maybe you could start the file with Maybe we should respect whatever |
Especially, code formatting: this is an endless subject! 😄 |
Code formatting is, yet somehow in golang they managed to all agree on something. Persinally, I won't say that I loved everything Because to me it's better to follow less than ideal lints/formatting rules, if it means everybody does the same thing. But that's just my personal opinion :) (After a while coding in golang I was more concerned with deadlocks and race conditions than code formatting anyways, hehe 😁) |
@cedx: I'm pretty sure that one-liner if statements are allowed without curly braces. Also worth to point out that dartfmt never modifies the non-whitespace characters, only indents the code, and I believe this is how it should be doing it. Adding curly braces should be your decision. As Jonas pointed out, you can tag your source files to ignore specific lints you don't agree with, however, in the future we may also expose that in the analysis. In the past we had many request to tune the analysis options in one way or the other, to enable more things or to make it more strict. I believe the current approach to follow the recommended standards and defaults is a good balance, and we will keep it over the developer-provided one. |
They are.
It does have a few |
Code formatting is a personal preference. This does not necessarily indicate that a package is of poor quality. Packages following the style conventions can be of very poor quality (security flaws for example).
However, the score of packages that do not use the style conventions defined by the Dart team are now penalized on the Pub website.
I find it really weird: I'm not going to stop using the Dart SDK because it's not coded as I would have liked. Yet the Dart SDK does not apply the stylistic conventions you have defined, far from it.
It's a bit like saying: "do what I say, not what I do". It's unfair.
The text was updated successfully, but these errors were encountered: