Hey guys, we have created a linter (checker + auto...
# announcements
a
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 if you will have a chance try it in your CI/CD :)
r
How does it compare to https://github.com/detekt/detekt?
1
v
It uses detekt in its build. :-D
a
No, it’s not true. Detekt is used for a static analysis. And diktat - is a custom rule set for ktlint, not detekt. It is related to a code style and code smells issues
Diktat - is a code style and is a custom ruleset powered by ktlint framework with a hundred of complex checkers and fixers that can detect code style and code smell issues.
Btw - ktlint itself is used in detekt project.
v
Of course it's true: https://github.com/cqfn/diKTat/pull/15 I didn't say diktat is a detekt rule set.
a
Ah, I thought you are saying that diktat is a wrapper over detekt. Sorry, me bad :)
Diktat - is using detekt because they have different purposes of usage, they are different tools. Diktat - is a detection system for codesmells and codestyle issues . And detekt - is more complex static analyzer. Btw - detekt is using ktlint and it’s standard ruleset - the framework that was used to create diktat :)
v
I personally didn't really understand yet what the difference is. Both tools are linters, both do static code analysis, both find code style issues and smells.
1
r
both tools have rules that do exactly the same things
e.g. detekt: AbsentOrWrongFileLicense, diktat: HEADER_MISSING_OR_WRONG_COPYRIGHT
a
Depends of what are you comparing. Detekt vs Diktat or Diktat vs Ktlint. 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. Detekt itself - is a static analyzer that uses ktlint for codestyle and codesmell issues under the hood.
r
if you would like to use both tools at the same time, you will have to configure both
a
@Robert Jaros ktlint is not configurable. You cannot customize it in the way diktat can. You cannot customize rules that you are using. Also in diktat we have much more rules than are there in ktlint. 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 :)
By the way - actually there is no problem to use both ktlint and diktat together. As they are using the same framework under the hood - you can run both two rule sets on the same code.
r
But should we treat diktat as a replacement or as a addition to detekt?
a
We treat and use it as codestyle checker and fixer. Mostly all rules can be fixed automatically
May be one day we will be able to merge detekt with diktat (as it was done with detekt and ktlint)
By the way - you are saying detekt, but you never mentioned ktlint. And it is much more popular and has more stars on github :) Do you use it?
r
I was using detekt in my project some time ago, but I had to remove it because of some issues.
I've never used ktlint
a
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.
And also diktat has it’s own VERY strict and formal codestyle for Kotlin that is already used in several companies. https://github.com/cqfn/diKTat/blob/master/info/diktat-kotlin-coding-style-guide-en.md
r
And that's the answer I was looking for ;-)
k
is there a sonarqube plugin?
a
No, @kqr, but we will create a github plugin first. Now we have created only maven plugin. We will create a gradle plugin, idea plugin, github and sonarqube plug-ins in the nearest future
k
👍
a
@kqr please help us to attract people to our project so it will grow up and give us a star :)
We are trying to make code better and help developers for free :)