How to Automatically Fix Your Code Style With Ktlint - Android Studio Tutorial

  Рет қаралды 29,173

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 68
@dotneko9059
@dotneko9059 2 жыл бұрын
Oh yes. Ktlint is awesome. Great video as always, Phillip
@olegleonov1310
@olegleonov1310 2 жыл бұрын
Why don't you use a more general solution, for example, detekt? It shows problems right in the IDE without build, has its own rules, can generate reports and can be added in Gradle build.
@Zefanya-Teki
@Zefanya-Teki 2 жыл бұрын
What are the downsides of using detekt straight in the IDE? We use it at work, but we only run it manually (usually before comitting)
@amrel-madah5277
@amrel-madah5277 2 жыл бұрын
@@Zefanya-Teki U can use pre-commit or pre-pish as a githook to run that check automatically before every commit or push
@Zefanya-Teki
@Zefanya-Teki 2 жыл бұрын
@@amrel-madah5277 Thanks :)
@kotl4931
@kotl4931 2 жыл бұрын
detekt has a wrapper for ktlint , it also allow to auto-correct if enabled .the advantage of using the wrapper is that you can see all the formatting rules in config.yaml instead of jumping to the reports files
@aviksutar
@aviksutar Жыл бұрын
best!! falling in love with every tutorials of yours
@tonnie7079
@tonnie7079 2 жыл бұрын
Reminds me of Police who maintain order, KtLint would be ideal to stop my code running berserk. Thanks for sharing.
@lakshminarayanacharan837
@lakshminarayanacharan837 Жыл бұрын
Wonderful stuff philipp Love from India
@BapeRuLLZ
@BapeRuLLZ 2 жыл бұрын
How we did it when I worked with a team is that we agreed upon a code formatting style we all liked and then one of us configured it in android studio in the code auto-formatting options and then he shared the config file with the rest of the team and we imported it. Then you turn on auto formatting on save, or just get used to using ctrl+alt+L and there you go.
@smart1hashi
@smart1hashi 2 жыл бұрын
Beautiful Explanation. Do you have playlist for beginners but not soon beginners to learn from Just saw your channel first time today and subscribed straight after this video
@minds_clear_02.23_
@minds_clear_02.23_ 8 ай бұрын
Perfect! It's really simple! Philipp, thank you!!!
@maximooze3196
@maximooze3196 2 жыл бұрын
Next SonarQube @Philipp 👍🏻, thank you for another good content.
@leosvxy
@leosvxy Жыл бұрын
Great tutorial Philipp ! , but there are somethings that are different now, could you do an updated video please? , that would be awesome, Thanks in advanced!
@tonnie7079
@tonnie7079 2 жыл бұрын
Any idea on how to do it using Kotlin DSL
@moumnalmunawy1806
@moumnalmunawy1806 2 жыл бұрын
Why people use sealed class for navigation instead of enum?
@rhen4610
@rhen4610 2 жыл бұрын
He already made his statement about that on another video
@purplehazer417
@purplehazer417 2 жыл бұрын
enum on steroids
@UpLiftingU007
@UpLiftingU007 2 жыл бұрын
How you will pase any paramter with enums?
@fernando_s97
@fernando_s97 2 жыл бұрын
because of parameters
@moumnalmunawy1806
@moumnalmunawy1806 2 жыл бұрын
@@UpLiftingU007 you can via the constructor
@amirhosseinghafoorian9985
@amirhosseinghafoorian9985 Жыл бұрын
so useful video, I will definitely use it in my project
@taar1
@taar1 2 жыл бұрын
Is this an official tool from JetBrains or Google or private third party?
@Adam0001
@Adam0001 2 жыл бұрын
On time 😊, Thanks Philipp 💐
@AhmedBenFadhel
@AhmedBenFadhel Жыл бұрын
Thank you for this video. I want to know what to do to make ktlint run on a specific buildType (for example debug BuildType) and having as a result only one report "KtlintDebugSourceSetCheck" ?
@dharamveergupta1305
@dharamveergupta1305 2 жыл бұрын
It was a great guide, Can you make one set-up guide for SonarQube for SonarLint.
@ewomer100
@ewomer100 2 жыл бұрын
Is there a way to get this to work if you refactor change the name of the source directory 'java' to 'kotlin' ? As it is now the formatting only works if the sub folder's name is java
@Daaaaaaavid
@Daaaaaaavid Жыл бұрын
"Task with path 'ktlintFormat' not found in project"?
@alexandervlasik7178
@alexandervlasik7178 2 жыл бұрын
Philipp, thank you very much. I really enjoy your videos. Do not stop, please. And why did you stop to make android news videos?
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thanks! In the past months there weren't any major changes worth to make a whole video about I felt like. I'll make them when something cool changes :)
@easybusinessou
@easybusinessou 2 жыл бұрын
Thanks
@CHIchangching
@CHIchangching 2 жыл бұрын
Philipp, can you please share how to set ktlint for specific folder or path only? I tried with in Android block sourceSets { main { java.srcDirs = ['src/main/java'] res.srcDirs = ['src/main/res'] manifest.srcFile 'src/main/AndroidManifest.xml' } } but when i ran ktlint, it still by default runs for AndroidTests, and Test folder. Any ideas?
@safionweb
@safionweb 2 жыл бұрын
Great content 👑
@Nick-cx4rs
@Nick-cx4rs 4 ай бұрын
Why my gradle doesnt find this task. Also not finding clean, assemble, etc. Task with path 'preBuild' not found in root project
@marlonlom
@marlonlom 2 жыл бұрын
Ktlint is great! how to use it across all modules for the gradle project?
@abdulraafay5226
@abdulraafay5226 2 жыл бұрын
Hi, could you make a video on how to cache images that were retrieved from a network request.
@simonwambua3710
@simonwambua3710 Жыл бұрын
Whats the difference in usage between ktlint and spotless?
@masti437
@masti437 2 жыл бұрын
Hi Philip ... I am a subscriber of your paid courses ... The content you add are amazing and valuable and I love it. I want to request a content ............... We use git with android studio right via terminal and via UI interface .... can you show all the stuff that you can do with the UI in android studio git functions(Not via terminal) .... there are no source materials on this on internet .... Thank you
@Another0neTime
@Another0neTime 2 жыл бұрын
All your video are belong to us. But seriously, great video.
@ArunKumar-vu5bd
@ArunKumar-vu5bd 2 жыл бұрын
When you prebuild ktlint error every time, doesn't it increase the build time?
@sachinmalik9574
@sachinmalik9574 2 жыл бұрын
yes it does, other alternative is to run it precommit
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Yep that works too 👍
@vitalijuskolinko9011
@vitalijuskolinko9011 11 ай бұрын
Thank you, my master :) Nice plugin, but it works a little bit buggy - sometimes it doesn't show changes in COMMIT section after I run ./gradlew-ktlintFormat. Need to restart Android Studio :)
@e4basil
@e4basil 2 жыл бұрын
nicely explained
@mandroidx1474
@mandroidx1474 2 жыл бұрын
How about sonarLint?
@Leon-un2ii
@Leon-un2ii 2 жыл бұрын
Could you also make a tutorial on how to make an app lock screen with a password or pin, please?
@stanleykou5643
@stanleykou5643 2 жыл бұрын
Awesome!
@mustafaammar551
@mustafaammar551 2 жыл бұрын
very cool vedeo you are the best
@pr0adam
@pr0adam 2 жыл бұрын
sometimes android studio wont even know the lazy list syntax if you dont do the wildcard import lols
@purplehazer417
@purplehazer417 2 жыл бұрын
thanks, just thought about that :)
@medium010
@medium010 Жыл бұрын
./gradlew: Permission denied
@PREATOR_1
@PREATOR_1 2 жыл бұрын
works gj
@renzcarlosalanga1970
@renzcarlosalanga1970 2 жыл бұрын
detekt is better in static code analysis
@wiiznokes2237
@wiiznokes2237 2 жыл бұрын
There is a shortcut for doing that automaticaly i think
@PhilippLackner
@PhilippLackner 2 жыл бұрын
And who wants to go into every file manually and apply that shortcut? 😂
@flavouredflight8628
@flavouredflight8628 2 жыл бұрын
ah yes! ctrl+alt+l
@wiiznokes2237
@wiiznokes2237 2 жыл бұрын
@@flavouredflight8628 Yes! And you can select a directory, otherwise CTRL + SHIFT + ALT + L
@simpleuxapps8759
@simpleuxapps8759 2 жыл бұрын
@@wiiznokes2237 That shortcut handles only formatting issues. It dosen't addresses other lint issues, such as unused imports.
@salvadorjohndeniel
@salvadorjohndeniel 2 жыл бұрын
@@simpleuxapps8759 It also removes unused imports
@sheikhs4896
@sheikhs4896 Жыл бұрын
In an Android developer i also want to work in Germany..
@sergioqcostas
@sergioqcostas 2 жыл бұрын
I love your videos but hate every lint out there, lol.
@alnoormajzoob2507
@alnoormajzoob2507 2 жыл бұрын
I have learned a lot of because of u, thanks 🙏. Can we msg at whatsapp?
Top 5 Mistakes That Make Your Kotlin Code a Mess
12:17
Philipp Lackner
Рет қаралды 23 М.
How to Automate Tasks Using Gradle - Android Studio Tutorial
18:55
Philipp Lackner
Рет қаралды 28 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Automatically Make YOUR Code Spotless!
13:07
Charfaoui Younes
Рет қаралды 1 М.
Getting the most out of Android Lint (Android Dev Summit '18)
21:00
Android Developers
Рет қаралды 13 М.
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 29 М.
Zero to IDE with LazyVim
16:59
Elijah Manor
Рет қаралды 414 М.
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 142 М.
Most overpowered way to build mobile apps?
8:33
Beyond Fireship
Рет қаралды 874 М.
How to Boost Your App's Performance With Baseline Profiles
16:56
Philipp Lackner
Рет қаралды 23 М.