SlideShare a Scribd company logo
1 of 21
Plugin and Play
PLUGINS THAT SUPPORT THE FULL SPECTRUM OF KOTLIN FEATURES
11-10-2022
by
Simone
de
Gijt
Introduction
Simone de Gijt
2016
2017
2018
2019
2020
2021
…
- Kotlin 1.0 released
- Started working in IT
Google announces that Kotlin is the preferred language of
Android app developers
- Signs contract @ OpenValue
- Starts working with Kotlin
@de_gijt ∙ Plugin and Play with Kotlin
What to
expect?
 Kover
 Code covarage
 Options
 Advantages / Disadvantages
 Demo of usages / configuration
 Detekt
 Code smells
 Options
 Adventages / Disadvantages
 Demo of usages / configuration
@de_gijt ∙ Plugin and Play with Kotlin
Kover
{kof· fer}
Kover - Gradle plugin for Kotlin code coverage agents:
IntelliJ and JaCoCo.
@de_gijt ∙ Plugin and Play with Kotlin
Code
coverage
@de_gijt ∙ Plugin and Play with Kotlin
Options
 JaCoCo
Existing tool
Well-known and widely
recognized format
Has some quirks regarding
Kotlin
 IntelliJ IDEA
Available in IntelliJ IDEA
Handles Kotlin well
Only available in IntelliJ
IDEA
@de_gijt ∙ Plugin and Play with Kotlin
assertThat(service.greet(null))
.isEqualTo("Hello world")
@de_gijt ∙ Plugin and Play with Kotlin
@de_gijt ∙ Plugin and Play with Kotlin
Advantages Kover
 Provided by JetBrains
 Fully integrated with the Gradle toolchain and multiplatform projects.
 Kotlin Android support without the need to divide into build types and
flavours
 Customizable filters for instrumented classes
 Exportable reports
 Handles specific Kotlin features
@de_gijt ∙ Plugin and Play with Kotlin
Disadvantages
 Still in an experimental state
 Only available for Gradle (not Maven)
@de_gijt ∙ Plugin and Play with Kotlin
Demo
https://github.com/SimonedeGijt/example-kover
@de_gijt ∙ Plugin and Play with Kotlin
Detekt
{de· tect}
Detekt - A static code analysis tool for
the Kotlin programming language.
@de_gijt ∙ Plugin and Play with Kotlin
Code smells
@de_gijt ∙ Plugin and Play with Kotlin
Options
 Sonarqube
 Very nice reports that integrate with Gitlab
 You get a lot of extra’s..
 Community and paid versions
 Megalinter
 Free
 Not Kotlin specific
@de_gijt ∙ Plugin and Play with Kotlin
Advantages
 Highly configurable rule sets
 Specification of quality gates which will break your
build
 SonarQube & IntelliJ integrations
 Third party integrations for Maven, Bazel and Github
Actions (Docker based and Javascript based)
 Possibility to add Ktlint
@de_gijt ∙ Plugin and Play with Kotlin
Ktlint
@de_gijt ∙ Plugin and Play with Kotlin
Ktlint
Formatter + Linter
@de_gijt ∙ Plugin and Play with Kotlin
Pinterest
Demo
https://github.com/SimonedeGijt/example-detekt
@de_gijt ∙ Plugin and Play with Kotlin
Sources
 https://github.com/Kotlin/kotlinx-kover
 https://github.com/detekt/detekt
 https://detekt.dev
 https://github.com/detekt/sonar-kotlin
 https://pinterest.github.io/ktlint/
 https://github.com/pinterest/ktlint
@de_gijt ∙ Plugin and Play with Kotlin
Questions
@de_gijt ∙ Plugin and Play with Kotlin
Contact
Twitter:
@de_gijt
LinkedIn:
Simone de
Gijt
Slideshare:

More Related Content

Similar to PluginandPlay_DevoxxBE.pptx

Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdf
uzair
 

Similar to PluginandPlay_DevoxxBE.pptx (20)

Android studio 4.0 new features preview
Android studio 4.0 new features previewAndroid studio 4.0 new features preview
Android studio 4.0 new features preview
 
Why You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdfWhy You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdf
 
GitHub Vs GitLab | What Are The Major Difference?
GitHub Vs GitLab | What Are The Major Difference?GitHub Vs GitLab | What Are The Major Difference?
GitHub Vs GitLab | What Are The Major Difference?
 
Android Study Jams- Hands on Experience!(Day 1)
Android Study Jams- Hands on Experience!(Day 1)Android Study Jams- Hands on Experience!(Day 1)
Android Study Jams- Hands on Experience!(Day 1)
 
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
 
Kotlin for android development
Kotlin for android developmentKotlin for android development
Kotlin for android development
 
What's new with Kotlin - Google IO18' extended Covenant University.
What's new with Kotlin - Google IO18' extended Covenant University.What's new with Kotlin - Google IO18' extended Covenant University.
What's new with Kotlin - Google IO18' extended Covenant University.
 
Lesson 5 Layouts.pptx
Lesson 5 Layouts.pptxLesson 5 Layouts.pptx
Lesson 5 Layouts.pptx
 
Android Development with Kotlin course
Android Development  with Kotlin courseAndroid Development  with Kotlin course
Android Development with Kotlin course
 
Android with kotlin course
Android with kotlin courseAndroid with kotlin course
Android with kotlin course
 
Android Layouts
Android LayoutsAndroid Layouts
Android Layouts
 
MOOC_PRESENTATION_KOTLIN[1].pptx
MOOC_PRESENTATION_KOTLIN[1].pptxMOOC_PRESENTATION_KOTLIN[1].pptx
MOOC_PRESENTATION_KOTLIN[1].pptx
 
moocs_ppt.pptx
moocs_ppt.pptxmoocs_ppt.pptx
moocs_ppt.pptx
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
8 Reasons to Pick Kotlin Over Java for Android Development.pptx
8 Reasons to Pick Kotlin Over Java for Android Development.pptx8 Reasons to Pick Kotlin Over Java for Android Development.pptx
8 Reasons to Pick Kotlin Over Java for Android Development.pptx
 
Kotlin native for iOS and Android
Kotlin native for iOS and AndroidKotlin native for iOS and Android
Kotlin native for iOS and Android
 
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
What's new in Android, Igor Malytsky ( Google Post I|O Tour)What's new in Android, Igor Malytsky ( Google Post I|O Tour)
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
 
Git tech
Git techGit tech
Git tech
 
Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdf
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
 

More from SimonedeGijt

More from SimonedeGijt (18)

Co-creating_between_UX_and_Software_Rabobank
Co-creating_between_UX_and_Software_RabobankCo-creating_between_UX_and_Software_Rabobank
Co-creating_between_UX_and_Software_Rabobank
 
Wired_Voxxed_Days_CERN_22-01-2024_Wired__
Wired_Voxxed_Days_CERN_22-01-2024_Wired__Wired_Voxxed_Days_CERN_22-01-2024_Wired__
Wired_Voxxed_Days_CERN_22-01-2024_Wired__
 
Wired_DevoxxBE_05102023.pptx
Wired_DevoxxBE_05102023.pptxWired_DevoxxBE_05102023.pptx
Wired_DevoxxBE_05102023.pptx
 
Co-creating with UX and Software Rabobank
Co-creating with UX and Software RabobankCo-creating with UX and Software Rabobank
Co-creating with UX and Software Rabobank
 
Wired_Rabobank_27062023.pptx
Wired_Rabobank_27062023.pptxWired_Rabobank_27062023.pptx
Wired_Rabobank_27062023.pptx
 
Wired_JoyOfCoding_21062023.pptx
Wired_JoyOfCoding_21062023.pptxWired_JoyOfCoding_21062023.pptx
Wired_JoyOfCoding_21062023.pptx
 
Wired_DDD-Europe_09062023.pptx
Wired_DDD-Europe_09062023.pptxWired_DDD-Europe_09062023.pptx
Wired_DDD-Europe_09062023.pptx
 
Co-creating_UX_Software_VoxxedDaysIasi.pdf
Co-creating_UX_Software_VoxxedDaysIasi.pdfCo-creating_UX_Software_VoxxedDaysIasi.pdf
Co-creating_UX_Software_VoxxedDaysIasi.pdf
 
Wired_DevoxxUK_10052023.pptx
Wired_DevoxxUK_10052023.pptxWired_DevoxxUK_10052023.pptx
Wired_DevoxxUK_10052023.pptx
 
Co-creating_UX_Software-DevoxxUK.pdf
Co-creating_UX_Software-DevoxxUK.pdfCo-creating_UX_Software-DevoxxUK.pdf
Co-creating_UX_Software-DevoxxUK.pdf
 
Wired_DevNexus_06042023.pptx
Wired_DevNexus_06042023.pptxWired_DevNexus_06042023.pptx
Wired_DevNexus_06042023.pptx
 
Wired_DevNexus_06042023.pptx
Wired_DevNexus_06042023.pptxWired_DevNexus_06042023.pptx
Wired_DevNexus_06042023.pptx
 
Wired_Javaland_22032023.pptx
Wired_Javaland_22032023.pptxWired_Javaland_22032023.pptx
Wired_Javaland_22032023.pptx
 
Co-creating_UX_Software_JFALL.pdf
Co-creating_UX_Software_JFALL.pdfCo-creating_UX_Software_JFALL.pdf
Co-creating_UX_Software_JFALL.pdf
 
Co-creating_UX_Software_DevoxxBE.pdf
Co-creating_UX_Software_DevoxxBE.pdfCo-creating_UX_Software_DevoxxBE.pdf
Co-creating_UX_Software_DevoxxBE.pdf
 
Wired_VoxxedCluj_06102022.pdf
Wired_VoxxedCluj_06102022.pdfWired_VoxxedCluj_06102022.pdf
Wired_VoxxedCluj_06102022.pdf
 
Co-creating_UX_Software_VoxxedAthens2022.pdf
Co-creating_UX_Software_VoxxedAthens2022.pdfCo-creating_UX_Software_VoxxedAthens2022.pdf
Co-creating_UX_Software_VoxxedAthens2022.pdf
 
Wired_JSpring_08062022.pptx
Wired_JSpring_08062022.pptxWired_JSpring_08062022.pptx
Wired_JSpring_08062022.pptx
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

PluginandPlay_DevoxxBE.pptx

Editor's Notes

  1. Hello everybody, welcome to my talk Plugin and Play! I am so happy that you choose to come see my talk eventhough it’s the end of the day. Can I see some hands on who has been here since yesterday? And from those people can I see some hands who will stay here until Friday? Wauw, that’s diehard, really cool. Let’s give those people a round of applaus shall we?! Allright, without further adue let’s get started because we only got like 30 minutes.
  2. I am Simone de Gijt and my buddy Kotlin and I started working in IT from 2016 on. In 2019 he got a big promotion, when Google announced that Kotlin was the preferred language of Android app developers. But it was only until I started working for OpenValue as a Java developer that I really got to play around with him.
  3. Now in todays talk we will go over 2 plugins, which both will increase the quality of your code base. The first being Kover and the second Detekt. As you can see the structure is quite equal and at the end of each introduction I will give a short demo on how you can configure the plugin for yourself.
  4. The first plugin we’re going to talk about is Kover. Now you might wonder what Kover is.. Or rather who he is… László Kövér is a Hungarian politician, which is obvious by his moustache. And a little fun fact.. If you would go to a Dutch or Belgium store and ask for a “kover” you would get.. This. You write it a little different though, with double f. But hey, who cares. Okay but all jokes aside: Kover is a gradle plugin for Kotlin code coverage agents: IntelliJ and Jacoco. https://github.com/Kotlin/kotlinx-kover
  5. Now most of you will probably know what code coverage is, and if not: I would highly recommend you to go to one of the “testing” talks which will probably come up in the next couple of days. But to sum it up: Code coverage is a way by which you can calculate how much of your code has been reached by tests. And calculation, often is visualized like the class file over here. Where green means it has been reached by the tests, red it hasn’t been reached by tests and yellow it only partly has been reached by tests. Now you might already know some code coverage agents that provide this insight for you
  6. One of them being the code coverage agent provided by IntelliJ IDEA. And if I am honest. This code coverage agent deals very well with Kotlin. Makes sense right, because they are both developed by JetBrains. However, IntelliJ doesn’t provide you a report and therefore the result of the code coverage cannot be exported out of IntelliJ. Making it impossible for you to integrate into your CICD pipeline for example. Oh and.. If you are a Eclipse user, yeah.. Then this is most definitely not an available option for you. The second option you might very well know as it’s quite commonly used. Jacoco. Jacoco stands for Java code coverage and that is precisely what it does. It checks Java code for coverage but unfortunately we are writing in Kotlin. Leading to some issues when we would use it on our code base. Let’s take an example: Source: Kover – The Code Coverage Plugin https://www.youtube.com/watch?v=jNu5LY9HIbw
  7. I have here a class consisting of 3 methods. The first being an inline function, the second being a method without an input parameter and the last a method with nullable input parameter. Now if I would execute a test that would call upon the greet method with a null as input. How many methods do you think would be hit? The correct answer is three. It first goes into the last method because we enter an input parameter which is null, than that method calls upon the second method and the second method calls upon the inline function. Now if we would have run our Jacoco coverage tool on this code we would get this report:
  8. Weirdly enough, the inline function has a coverage of 0%. This is because Java doesn’t know about inline functions and therefore it doesn’t register it. Now you might also notice that the nice visualization of a few slides before is gone.. This is because Jacoco doesn’t know about the Kotlin directory structure and therefore can’t find the original class file. But fortunately we have a solution..
  9. Kover. Kover is a plugin provided by Jetbrains, integrates fully with the gradle toolchain and multiplatform projects. It has some kotlin android support, filters for instrumented classes, exportable reports that you can use in your CICD pipeline and most importantly handles Kotlin features pretty well. Now I could leave it at that, but I feel that I also should give you some of the disadvantages. Sources: Kover – The Code Coverage Plugin https://www.youtube.com/watch?v=jNu5LY9HIbw https://github.com/Kotlin/kotlinx-kover https://kotlinlang.org/docs/multiplatform.html
  10. First being that Kover came only out in december last year with the mentioning that it is still in an experimental state. Meaning that there can be some bugs, but my experience so far is that Jetbrains is very involved in this project and dedicates time on fixing the bugs pretty quick. Now second disadvantages is that it’s currently only available for Gradle. There is currently an open issue for that, so you can definitely go to the project and give that issue a like. But for now, you need to sit and wait this one out. Or switch to gradle ;)
  11. Demo: Start with showing that Jacoco is greyed out Show config of detekt Run, show report: inline function + test folders Add excludes: show report Add verify: show build Questions if time
  12. For our second plugin, we are going to take a look at Detekt. Detekt is a static code analysis tool for kotlin. Now that sounds cool, but what does it analyse?
  13. It detects code smells. Now code smells can be considered as bad practises. In most cases your code will still work, but the quality.. Meehh not so high. In general code with a lot of code smells is considered hard to read, hard to maintain, hard to understand. Now a small example of a code smell, considered by Detekt would be this if statement with four conditions. Detekt states that this is a “ComplexCondition” and should be reduced to maximum of 3. Now just as with Kover we also have a few options to detect those code smells
  14. One of them being Sonarqube. Most of you will have heard of it. It is a widely known tool, which generates nice reports. It has both a community as a paid version. So this can also be a nice option. However, because sonarqube is a very extensive tool, I feel it is less plugin-and-play as Detekt is. Second we have megalinter but this is unfortunately not kotlin specific.
  15. Now some advantages of Detekt are that it has a very configurable rule set and eventough I don’t like to admit it. Code smells are often subjected to personal taste. Now I could spent another talk on how this mindset iss not benefitial for anyone in the long run, but for now let’s skip that and let’s leave it as a positive note that you can change rule sets to make them fit to your liking. Now you also configure quality gates within your build or within your CICD pipeline It has a bunch of integrations. And last but not least there is a possibility to add Ktlint. Now what is Ktlint you might wonder..
  16. Ktlint is a linter to wipe a kitty clean with
  17. However, it is also a linter and formatter for Kotlin code, coming from the Pinterest project. In short ktlint detects the code that is not complying to the kotlin code style. So for example; a wrong alfabetical order of imports, wrong indentation or spaces.
  18. First show detekt plugin and ktlint dependency Show how build fails on both test and main code Show service class -> show plugin (enable ktlint) Change settings Show reports