Hey, I'm writing a library and I was wondering if ...
# getting-started
t
Hey, I'm writing a library and I was wondering if it was possible to have an annotation or something to define the max length a String should be and if it goes over that just give an IDE warning? I'll of course add built-in checks but I just thought this would be a little nice to have some warnings if developers go over how long the String should be.
v
Have you tried make custom lint rules.? You can check for example Timber's lint module, in it there's a lint check that pops a warning if a tag-argument is longer than 23 chars https://github.com/JakeWharton/timber/blob/trunk/timber-lint/src/main/java/timber/lint/WrongTimberUsageDetector.kt#L142C30-L142C30 Hope this helps 🙂
t
Thank you for the suggestion!