https://kotlinlang.org logo
Title
a

akuleshov7

10/31/2020, 1:37 PM
Hey guys, we have created a linter (checker + autofixer) for Kotlin with a huge number of rules. Will be great if you will support it at least with a very simple thing: star on a GitHub: https://github.com/cqfn/diKTat But it will be also great if you will have a chance try it in your CI/CD :) We are already added to awesome-kotlin and awesome-static-analysis, but still need some support from you!
2
Diktat - is a a formal codestyle and a custom ruleset with a much more detection rules than ktlint has in it’s ruleset. We have ~100 configurable rules and a formal codestyle for detecting issues. We have more rules than ktlint, they are much more complex and we have a formal style guide that describes all rules that we are checking and fixing. Also we have a great configuration mechanism that allow you to change and customize your ruleset. ktlint is not configurable. You cannot customize it in the way diktat can. You cannot customize rules that you are using. And detekt itself is used for different purposes - it is a functional bugs detection system. For code style it uses ktlint, so see the first point :) Diktat itself - is a static analyzer that uses ktlint for codestyle and codesmell issues under the hood. The idea is simple: you have different tools. One is - a static analyzer that does some searching for bugs (but actually bugs are pretty simple). It is detekt. The second approach - is ktlint - a checker and autofixer. It handles all your problems related to codestyle. And if you are lazy - it can fix them for you automatically :) Diktat - is a plugin for ktlint. A huge number of rules that can check and fix codestyle issues. To get more information you can see our read me and soon will able to check our white paper.
f

Fabian Braun

10/31/2020, 1:54 PM
Looks good, does it support auto-fixing as well?
oh yes, saw it… how did I overlook it in the first place?
a

akuleshov7

10/31/2020, 1:55 PM
@Fabian Braun of course! Everything goes out of the box :) 100+ inspections (80% of them are autofixed) 😅
f

Fabian Braun

10/31/2020, 2:08 PM
Cool, what jumps quickly to my eyes positively: autoarrangement of class declaration parts, autofix return statements to expression bodies. What I probably would switch off: too rigid on line breaks (I tend to read horizontally), autogenerated KDoc
a

akuleshov7

10/31/2020, 2:10 PM
All rules are configurable :) You can disable or configure each and every rule manually. Even line breaks
1
👍 3
We will ad more documentation a little bit later :)
k

Karsten Gebbert

10/31/2020, 2:29 PM
Interesting! Could this be integrated with spotless?
a

akuleshov7

10/31/2020, 2:31 PM
Spotless already has small linter for Kotlin with a very few rules inside... They will not let us in...
k

Karsten Gebbert

10/31/2020, 2:33 PM
It integrates ktlint and ktfmt afaik, but supporting ktlint plugins won’t fly you think?
a

akuleshov7

10/31/2020, 2:35 PM
I am afraid that they will say that we are doing some duplication of work. But we are not, as we have 100 fixers and ktlint has 20...
But yes, we should at least try
k

Karsten Gebbert

10/31/2020, 2:35 PM
I agree wholeheartedly :)