Comments (16)
Detekt now uses the embeddable compiler. A KtLint rule set is now feasible.
Idea:
- Create new rule set with wrappers around all KtLint rules
- Delete spacing, indentation and newline rules from detekt-formatting, just keep the extra rules which feature ast manipulation
- Users have now the choice between formatting with
detektIdeaFormat
anddetektKtLintFormat
from detekt.
I'm at the moment using both tools. Ktlint only for formatting and detekt for everything else. I'd assume that also the way to go for the future.
from detekt.
PoC: 18be6bc
Fairly easy to integrate.
from detekt.
ktlint-standard-ruleset is not published to maven central as standalone artifact. Formatting rules were fixed and cleaned up for M11.
from detekt.
@arturbosch fyi: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22ktlint-ruleset-standard%22
from detekt.
@shyiko nice thx. Did not find it on my own :)
from detekt.
KtLint uses the embeddable kotlin compiler, detekt not.
The new recommend way for formatting is to use the detektIdeaFormat
task starting from M11.
from detekt.
So the idea is to get rid of the formatting part in detekt (detekt-formatting
) and leave it up to ktlint?
from detekt.
Yeah it would be best. I still do not know what to do with the formatting rules which ktlint does not have. Move them to StyleGuideProvider? Should detekt-rules
also support autoCorrect
? Should we leave detekt-formatting
with all rules and integrate KtLint into that module? Create a new detekt-ktlint
-module?
I think a hybrid detekt-formatting
module would be best (low change costs). We leave all rules as they are and wait until Ktlint releases new rules or fixes. Then we act and wrap one after the other rules. What do you think?
from detekt.
from detekt.
@arturbosch
I was scanning through the issue list. I think this feature is done, isn't it?
from detekt.
Yes, its done, some documentation is needed, but that can be done when we integrate the module into our CI, thanks for the reminder.
from detekt.
I am new to the project (just integrated it) and I'm a bit lost about role of ktlint in detekt.
So documentation would be helpful indeed.
I was researching why does detekt currently have to very similar rules NoWildcardImports
and WildcardImport
in its default config, so in the sources I discovered that one is coming from ktlint, another is "native"?
Is this ok, or should I report an issue (or I could submit a PR if you suggest me how this should be resolved).
from detekt.
@dimsuz
Detekt provides a wrapper over Ktlint.
Thereโs actually some documentation regarding the ktlint integration here.
If you have any suggestions for improvement, please feel free to open an issue. We are grateful for PRs regarding detekt's documentation.
from detekt.
Not too sure I understand how this ktlint integration works. If I add the ktlint integration as a formatting ruleset, does it mean detekt will report formatting errors, and if I do not add it, it won't report them? Can I possibly run code formatting with detekt once I add the ktlint integration?
from detekt.
@idrisadetunmbi I don't quite understand your question.
Detekt provides a wrapper over ktlint's rules with the formatting
ruleset.
It depends on whether you have the autoCorrect
and active
setting set to true in the formatting
ruleset.
from detekt.
Related Issues (20)
- Gradle Compiler Plugin - Exclude does not work at the ruleset level HOT 1
- Rule to verify calling super HOT 1
- Create an extension point at rule execution HOT 8
- reportsDir property omission in Detekt task for android and jvm configurations HOT 1
- KtFile.virtualFilePath returning file name without full path HOT 2
- Detekt ignoring excludes after updating Kotlin version HOT 6
- False positive NullableToStringCall HOT 3
- Fail lint for `error(throwable)` HOT 6
- Cannot use custom report output files as inputs to other tasks HOT 2
- Pre-Commit Detekt CLI: Exception in thread "main" java.lang.IllegalArgumentException: Provided path ''
- UnusedPrivateClass Rule does not detect casts as usage
- Task redundancy HOT 4
- RFC: KMP compilation analysis task names HOT 8
- Intermittent failures in IndentationRule causing 'Stack should be empty' errors
- Refactor `:detekt-tooling` HOT 1
- RFC: `detekt` Gradle task defaults HOT 6
- Redundant usage of Boolean.not() HOT 7
- Update docs for new Gradle plugin HOT 2
- Custom Detekt task doesn't respect `include()` function HOT 5
- Invalid SARIF on EmptyKtFile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from detekt.