-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add testDocumentationExample #244
Conversation
(FYI, that site doesn't get updated automatically, I do manual pushes every now and then. Yeah I probably should automate it. Here's the issue documentation generator by the way: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/cli/src/main/java/com/android/tools/lint/LintIssueDocGenerator.kt ) |
...basically, I try to have every lint check have a test which is just a "good example" of an error -- instead of (as I initially did) mixing a bunch of corner cases all into the same test. |
The bottom of your screenshot shows that it actually just picked the first unit test it could find. That's probably because it was from the last time I had run the docs generation -- before your change. I just updated the doc snapshot yesterday -- it now has the latest released version of the slack lint checks (91 issues included). And now it's picking up the default too -- it's no longer talking about having picked the first test etc:[ P.S. As I was looking I noticed that in some places there is no space between a previous sentence and the next one. I thought maybe there was an error in the formatting somewhere -- but I actually see it in the text messages in your unit tests too: https://github.com/slackhq/compose-lints/blob/main/compose-lint-checks/src/test/java/slack/lint/compose/ComposableFunctionNamingDetectorTest.kt -- look for "letter.They". I think what's going on is that you're passing in the explanation text as the error message (that's not usually recommended for reasons explained here: https://googlesamples.github.io/android-custom-lint-rules/api-guide.md.html#errormessageconventions/includedetails -- and your issue explanation seems to not put a space before the line continuation () characters. Maybe lint is using a different convention than other tools? But lint treats this kind of like string concatenations, e.g.
is the same as
So
is treated as "foobar". If what we're doing is different from a standard convention maybe we should change it. I suspect nobody actually wants the behavior where there's no space between the previous line and the next one, so we could just insert it... |
Hmmm a quick test makes it seem like at least shells behave the same way. So for the source code in https://github.com/slackhq/compose-lints/blob/main/compose-lint-checks/src/main/java/slack/lint/compose/ComposableFunctionNamingDetector.kt for example, I think the issue explanation should have an extra space before the \ on most lines. |
So a neat feature @tnorbye told me about recently is that adding a test with the name
testDocumentationExample
will automatically index as a sample error on the lint docs site (which index our lints!)This is a little test of that to see if it shows up here: