Replies: 39 comments 6 replies
-
@meyertime I think it might be more clear to say "If you agree with this course correction", because otherwise it could be read a little ambiguously; new direction could mean the course correction you proposed or the new direction that ktlint is currently headed in. |
Beta Was this translation helpful? Give feedback.
-
Good point. Updated. |
Beta Was this translation helpful? Give feedback.
-
Thanks @eygraber for pointing out this issue in the kotlinlang Slack. I think the fundamental tension is the been lack of general ownership and support of When we took over ktlint years ago there was a robust community of contributors (myself included) and for various reasons, we all stopped putting time into ktlint. @paul-dingemans has essentially single-handedly kept the project alive since then, spending what is likely hundreds of hours of his own personal time, and I want to acknowledge his enormous contributions to the project. As a result, it has become a single-maintainer project not really by design, but because he's the one putting in the vast majority of the work into the project. @meyertime I completely understand and acknowledge the frustration you're feeling; I do want to say in general that 'software by committee' is not a long term way to keep a project healthy, and that likely Paul is trying to strike a proper balance between the general principals of the project and trying to glean what the community at large wants. Let's in general try to avoid veering into the direction of personal attacks. For #2138 in particular, I would also consider this a regression, as we use this formatting in our own codebase. I think most Android developers would as well. I would be open to adding another maintainer or two (I suspect Paul will as well), and I would personally like to have someone who works primarily on Android, as that's obviously a huge proportion of the Kotlin userbase. |
Beta Was this translation helpful? Give feedback.
-
Thank you, @shashachu, for your thoughtful response. I agree that "software by committee" is not good long-term, and that isn't my intention here. I am also trying to gauge what the community wants and find out if many agree with me or if I am an outlier. I have seen some response here and in other forums that suggest that I am not the only one who is frustrated with the direction of Part of the problem is that I disagree with "the general principles of the project". As I described above, I think I also think the nature of linters in general is that they naturally reach a state where they are more or less "done" and do the job they're intended to do. At that point, it's just a matter of keeping up with any new language features that get added. I feel like At this point, I'm prepared to contribute as much as I can, but I'm not sure adding another maintainer would help if the maintainers don't agree on the principles. So I'm also trying to gauge if we can strike a balance or if it's time to fork. |
Beta Was this translation helpful? Give feedback.
-
@meyertime Forking in my opinion is a 'last resort' option and would probably be a worse outcome for everyone including the community, so I think we can come to a compromise. I agree with you that 'anti-bikeshedding' has largely been aspirational even from the beginning with ktlint, and it is true that ktfmt exists now as a Kotlin linting alternative and has a very different implementation. Would codestyles be a 'middle ground' here? Is the sticking point that you want to use I'd like to give @paul-dingemans a chance to respond here as well. I'm happy to also chat more real-time in kotlinlang, although I believe time zones might make that more difficult. |
Beta Was this translation helpful? Give feedback.
-
@paul-dingemans I just want to say that none of this was meant as a personal attack. Please understand that it is hard to be critical of the direction @shashachu I will respond to your questions soon. In the meantime, I did try to get into the Kotlinlang Slack yesterday, but wasn't able. Something about not having a jetbrains.com email address. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
I've been using ktlint for a long time. Originally through the detekt ruleset, and more recently directly through the ktlint binary. I agree with everything that @meyertime said. My list of disabled rules keeps growing, and my requests for bug fixes and new features are summarily dismissed. I think detekt is a good project to look up to in terms of configuration (as well as many other things). There's very sensible defaults, and the freedom to adapt it to your project as needed (within reason). I would love to see that level of freedom in ktlint, as well as an easier way to write rules (again following detekt). @meyertime have you tried http://surveys.jetbrains.com/s3/kotlin-slack-sign-up |
Beta Was this translation helpful? Give feedback.
-
Agreed!
I question the usefulness of including an opinionated, unconfigurable code style, especially when If
I'm glad we agree on this. Getting This brings up another issue. Historically, Finally, there's the issue of configurability. All of the problems with code styles would be a moot point if the rules were configurable. Then code styles would just be different starting configurations. We wouldn't have to argue about it, we could just configure So, in summary, if I were to rank my sticking points:
|
Beta Was this translation helpful? Give feedback.
-
@eygraber Thanks for the Slack sign-up link. I filled it out, and I'm waiting for a response. Also, thanks for the additional context. Full disclosure: I am relatively new to |
Beta Was this translation helpful? Give feedback.
-
Forking the project will not only harm the ktlint community, but all the API Integrations and possibly the Ruleset Providers (like compose-rules) as well. Each of those projects will have to decide what they will do. Follow the original project, or the fork, or both. I find it questionable that you make it sound that only my personal opinions are leading in this project. Of course, my personal opinion has had great influence on this project. This was not by design or intentional, but a consequence of a community which is not responsive enough to get accurate insights on future developments of the project. I have tried to reach out to the community before making changes. I have raised issues in the Github project and advertised for this in the Slack channel. The amount of responses was negligible. For the investigation regarding formatting the when-statement, I have used LinkedIn to gather feedback which worked surprisingly better. This feedback resulted in implementing a different default choice for formatting the statement.
The code styles The point that I want to make with above, is that style guides are not more than a guide. On a lot of details they are quite specific. On some points (trailing comma's) they explicitly leave it to the discretion of the developer to pick something reasonable. And, on other topics the guides do not mention anything at all. The Occasionally, I have tried to get more clarification about the Kotlin Coding Conventions by submitting an issue to the Jetbrains issue tracker. In issue, Roman Elizarov remarked:
A 'new' language feature like context receivers has still not resulted in an update of the style guide as of today. Should any request for formatting regarding such features be denied as no reference to it is found in the style guides? I think that the value of Let me clarify this with an example. Androids Kotlin Style guide explicitly defines a maximum line length of 100 characters. The Kotlin Coding Conventions does not specify any rule about it. In
I am glad that we agree on this. The
I disagree with the labeling If somehow functionality which is intended for
Minimizing the number of configuration options is born out of necessity. Lots of people just seem to assume that each of their favoured enhancements have to be built into the project. Often people than suggest to put the functionality behind a configuration setting. Although that can be helpful, it has the downside of introducing a lot of complexity. Not because of adding some conditional logic, but due to the (combinatorial) explosion of execution paths that result as of it. The least harmful configuration options, are the options which are related to numeric values like tab size, and number of parameters in a function before to start wrapping), and I have no real objection to those. Most harmful configuration options are the enumerations like code style, and function body expression wrapping. Removing existing configuration settings, and changing default settings (for example the indent style in
It is true that #2138 and #2423 have an unusual high number of participants that actively engage the discussion, and like or dislike comments. Even when every like or dislike of a comment would come from a unique visitor, those threads would count for 150 users. But it is more likely that some of those users have (dis)liked multiple comments resulting in less unique users that are voicing a complaint. Ktlint has tens of thousands of users. The vast majority of those users are invisible from the viewpoint of the project. We have no metrics about the usage patterns. We don't know how many users use a specific code style. We don't know which rules are disabled. We don't know the number of users per version of the ktlint rule sets. This makes decision-making hard. Even with input of some active users the outcome of any decision is still opinionated. What I do know from the ktlint-intelli-plugin version 0.22 (e.g. ktlint Active users in the ktlint project, including the Slack channel, typically have a question, an enhancement request, or they report a bug. They have an apparent reason to become active. Only some of them stay active for a longer period of time. The active users however miss a representation of users that are either satisfied with the project, or don't dare to raise their voice in public project regardless whether they like or dislike the project. How can anyone claim that they represent the entire ktlint community, and therefore should be listened to? I cannot claim to represent all ktlint users that are not active contributors or readers of this project issue. But neither can you claim that the active users in #2138 and #2423 do represent all users that wants this to be resolved in the way you propose. As maintainer and guardian of the project it is my responsibility to balance the interests of all users as good as possible. I am trying to balance requests from the Android community, the non-Android Kotlin community, the API Consumers and Ruleset Providers. This means that Each user that raises or supports an issue like #2138 and #2423 is important, and should be listened to within reasonable bounds. If a request is not followed up to your satisfaction, the next step is to actively contribute a change by raising a pull request. We can negotiate about which solutions are acceptable to both of us. @shashachu wrote:
I would prefer so select maintainer only after there is a proven track record on the project. This would require regular (code) contributions, performing code reviews, participate actively in discussions on the issue tracker, and responding on questions on Slack. I am open to mentoring a potential new maintainer. |
Beta Was this translation helpful? Give feedback.
-
As somebody who maintains a custom Gradle integration for a private project, I'll just follow whichever one actually works for us. Sadly I have to say that there's been no value in the additions to the ktlint style for us. |
Beta Was this translation helpful? Give feedback.
-
@paul-dingemans my conclusion from reading through your comments is that there are two options for moving forward:
In this case configuration would decrease the current bike shedding problem:
The fact is you're going to have a hard time getting quality feedback for formatting features, because no one cares about it until it's breaking their project. Aside from the fact that feedback is just opinion anyways, and there will never be consensus on opinion based matters. There isn't even broad consensus about the Kotlin style guide's inhospitality to variance. The only way to deal with that is by providing broader configuration options. Will it add complexity? Probably. Is it unattainable because of that? No, there are plenty of formatters/linters out there that work just fine while allowing a high level of configuration. Detekt is a prime example in the Kotlin community. They pick sane defaults, try to anticipate variant needs up front, and are open to adding configuration to address them as the community needs it. |
Beta Was this translation helpful? Give feedback.
-
As the primary maintainer of https://github.com/JLLeitschuh/ktlint-gradle these days, I don't really have a strong opinion about |
Beta Was this translation helpful? Give feedback.
-
I had one more thing to add: if governance of ktlint is being reconsidered from Pinterest's side, as @shashachu implied was possible, I'd suggest combining ktlint, klint-gradle, ktlint-intellij-plugin into a single GitHub org, then applying to become a member of CommonHaus (https://www.commonhaus.org/). Commonhaus has established some patterns and systems to help with community-project feedback loops, while not requiring projects adopt any specific pre-determined processes. |
Beta Was this translation helpful? Give feedback.
-
I'd like to add a comment from the perspective of an indifferent/happy user. I've used ktlint across several android related projects over the years and every so often it'll format my code in a way that is not expected. My current project has always been on the latest versions of the library. I usually shrug off the unexpected formatting and move on. I suspect a large chunk of users fall into this bucket. I would personally rather have a standardized rule set across all kotlin codebases than nitpick or add custom rules. It makes everything easier to read when we all have the same format. For these reasons I don't agree with the statement that a single maintainer will cause the community to crumble. That said, it seems like Pinterest is loosely maintaining this repo and the primary maintainer doesn't even work there. This is a big and important project for many organizations. Grabbing an android focused maintainer and migrating this project (and related plugins) to a single github org seems to be a viable option if Pinterest isn't as committed as they once were to maintaining ktlint. |
Beta Was this translation helpful? Give feedback.
-
Ok, well that answers that question. 😅 Yes, I will drive the change to make I said what I did because I didn't want you to think I was trying to take over in a hostile sense. Forking would have been a last resort, and yes, I would have been fully responsible for it then. So I'm definitely willing to share the burden with you. |
Beta Was this translation helpful? Give feedback.
-
@shashachu I still think it would be good if Pinterest could help when it comes to getting good feedback from the community. I'm sure I will run into the same problem as Paul eventually. I am focusing on making the one rule configurable initially (#2138), but then there will be the question of what else should be configurable and what those options should look like, and I won't want to make those decisions unilaterally. As it has been brought out before, people tend not to pay attention to Thanks again for your attention to this. |
Beta Was this translation helpful? Give feedback.
-
I think a "committee" might help here, where there's a group of people who are available to discuss rules, configuration, etc... That will hopefully solve the issue of no one contributing to the conversation until something goes wrong, as well as not requiring anyone on the committee to be active code contributors (if they don't want to be). I think it would be nice if one+ of the detekt maintainers would agree to be on the "committee" since they have experience and expertise with these kind of things (cc @BraisGabin). |
Beta Was this translation helpful? Give feedback.
-
I like it. Though we just talked about not wanting to do "software by committee". 😆 But we don't want design by dictator either. I think a balance is good. The leaders provide a unifying vision and ultimately decide, but with input from a committee of users to make sure it meets the needs of the larger community. |
Beta Was this translation helpful? Give feedback.
-
That's why I put "committee" in quotes 😅 I guess it's more people who are dedicating themselves to be available for discussion. |
Beta Was this translation helpful? Give feedback.
-
I think we have had very productive collaboration between ktlint and ktlint-gradle especially regarding API changes that might effect integration. I think @paul-dingemans has been very proactive and open in this regard. But this has mostly been via informal slack conversations on the kotlin slack. Maybe instead of "committee", we just need a dedicated space to have these discussions in a place that is easy for interested parties to find. Maybe the kotlin slack is that place or maybe there is something better. |
Beta Was this translation helpful? Give feedback.
-
I think those conversations can and should happen in the open (Kotlin slack, etc...). The idea of a "committee" is only that there are people dedicated to responding. |
Beta Was this translation helpful? Give feedback.
-
Yes, in the open of course, but maybe there is a way to make it easier to discover, or to gather feedback, such as something like this: https://www.commonhaus.org/bylaws/decision-making.html |
Beta Was this translation helpful? Give feedback.
-
I think the reality of the project is that at the end of the day, most users don't want to get involved in nitty gritty discussions about how their formatter works. So making it easier to discover or gather feedback might not matter as much because of that. Personally, making formal rules seems like a bit much to me, but I'd be interested in hearing what others think. |
Beta Was this translation helpful? Give feedback.
-
Just looking around at kotlin usage internal to Amazon, it seems like most teams set their ktlint version and never thought about it again. There's also almost zero people asking about ktlint in our internal support channels. I think the hypothesis that most people don't care about their linter after they set it up is true. A strict feedback loop might make it hard to make changes if we think people are not interested in giving feedback. |
Beta Was this translation helpful? Give feedback.
-
Until it does something they really don't like 😇 |
Beta Was this translation helpful? Give feedback.
-
FWIW, I'm in this boat. I'm at Amazon and use Kotlin. I was trying to upgrade my ktlint dependency a few days back, which brought me to #2138, as I was very unhappy with the result of that formatting. I agree with your sentiment. People just expect their linter/formatter to work the way they want. It isn't something that is top of mind until the output is something they greatly dislike. It's the only reason I came to this repo. Gathering feedback is probably pretty hard for a project like this. I also don't know how important it is. If the road Ktlint is headed down is to offer more configuration, feedback becomes less important. Ideally, if folks don't like what the default behavior is, they can just change the configuration and it is back to what they like. |
Beta Was this translation helpful? Give feedback.
-
I don't have the time for something like that, I can't give my long term commitment. But I'm nearly always on at Slack. If someone thinks that what we have on detekt could help ktlint I'm open to answer DMs or any |
Beta Was this translation helpful? Give feedback.
-
We have had fruitfull discussions here. But it is becoming a little messy with different topics being discussed. I have opened Github Discussion where we split the discussions per topic. Please keep on contributing via the discussion sections. |
Beta Was this translation helpful? Give feedback.
-
I've been using ktlint since way before 1.0 and to be honest I don't think the problem is necessarily becoming too opinionated, it's the pace and the way this is happening. We have more rules being created and breaking changes after 1.0 than before. I made a big effort on my previous project to iron out everything to 1.0, and it's been uphill from there. I really thing being opinionated (or mostly opinionated) is not the problem, but rather where and how is the "opinion" being formed. We should put a process in place where things are discussed before a new rule that re-formats the entire project drops in the standard rule set (that is the experience for most people). |
Beta Was this translation helpful? Give feedback.
-
The direction
ktlint
has been taken the past couple years has removed it from the needs of the community and alienated some of its users.Previously,
ktlint
aligned with the official style guides. Now, the default code style,ktlint_official
, is opinionated and conflicts with and exceeds the official guides. Since the guides no longer serve as an anchor, this default style ends up reflecting the personal opinion of the maintainer. Issues #2138 and #2423 are good examples of this, because the changes proposed have strong community support, and they are aligned with both official style guides, yet they have been refused.The
intellij_idea
andandroid_studio
code styles may be used for those who don't agree with the opinionatedktlint_official
style. However, there are some problems with this:ktlint
should more useful than one person's opinionated style.intellij_idea
andandroid_studio
styles have become second-class features. Opinionated additions fromktlint_official
have crept in, and these styles no longer align with the official style guides. With each new release, an additional rule or two has to be disabled to maintain alignment with the official guidance, and doing so may causektlint
not to enforce what the official guide does say in some cases.It's true that the original stated vision for
ktlint
may have included zero configuration in order to prevent "bikeshedding" about lint rules. In recent years, the direction ofktlint
has leaned heavily into this, desiring minimal configuration and consistency to the point of determinism, even at the expense of code clarity and readability. However, an opinionated, deterministic linter with no configuration options, ktfmt, already exists for Kotlin. We don't need another one. Also,ktlint
has gradually added some configuration options over time due to demand from the community. It's clear that people usektlint
because it is not deterministic and is configurable, so the stated vision and direction ofktlint
should be adjusted to align with this.Therefore, I am proposing the following course correction for
ktlint
:Re-brandktlint
as a community-driven, unopinionated, configurable linter, in the spirit of ESLint.Remove thektlint_official
style.Its rules may be kept as configurable options.No opinionated style that exceeds the official style guidance will be offered.Restoreintellij_idea
andandroid_studio
back toofficial
andandroid
, withofficial
the default.Bring these styles back into full alignment with the official style guides. Under default configuration, they will enforce only what the official style guides say, no more, no less.Any question as to what these styles should do by default will be decided by a review of the respective official style guide, not the opinions of the maintainers or contributors.If the official style guide is not clear on a particular matter, then the default will be not to enforce it either way, but it may be implemented as a configurable option.There will be no requirement that these styles be compatible with the built-in formatter of IntelliJ or Android Studio. At best, these are flawed implementations of the official style guides; the official guides are the standard we will measure by.Bump the version to 2.0 and remain pre-release (alpha, beta, release candidate) until all of the above are completed.ktlint
to enforce a more opinionated style can achieve this by configuring rules or enabling additional ones.If you agree with this proposed course correction, show your support by reacting with 👍. If you disagree, react with 👎. If you have a suggestion to improve this plan, please leave a comment.
EDIT: If you look further down in this thread, we have reached a compromise. Configurability will allow users to customize the styling enforced by
ktlint
, and that will be my focus. The existing code styles will remain as they are so as not to affect indifferent/happy users that are just using the defaults.Beta Was this translation helpful? Give feedback.
All reactions