Hey guys, I’m looking for some recommendations/adv...
# announcements
Hey guys, I’m looking for some recommendations/advice! I’m trying to automate code standards for my project…. First want to do simple things such as: • Check the top of the file to ensure it has a copyright + specific comment format • Enforce Kdoc/JavaDoc format for our functions I would like it to either Flag Bitbucket PR’s or reject builds if they do not comply I’ve already used File Templates & Live Templates… But this acts more of an aid instead of actually enforcing standards My current thinking is to use Android Lint and tie it to gradle to fail builds if they don’t comply, but I haven’t really researched this approach yet… • Starting to read up KTlint
ktlint should be able to handle those, but you'd need to write custom rules.
(I work for Pinterest, who took over maintenance of ktlint)
👍 2
You can invoke it yourself anytime during the build process and it can either auto correct or just fail
There are a couple popular ktlint Gradle plugins (linked from GitHub) you can use if you like
Wow you’re a beast! Thank you
We personally use phabrciator+arc so we invoke it pre-commit during the arc lint process
Yes that’d be perfect
It’d be annoying to have to add more commits in order to fix issues
@Sha Sha Chu For KtLint, I’m trying to detect comments but I can’t find a category under KtNodeTypes that seems to match comments
Same with Todo’s… What would that classify as?
in one of our custom rules we check
node is PsiComment
👍 1
and i believe
is just a regular kotlin function defined in the stdlib