-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add Lint Check for Licenses In New Files #8947
Comments
Is this still needed? |
It's not super high priority, but feel free if you're interested! Some other bugs that are ready to be worked on here if you're looking! https://github.com/mozilla-mobile/fenix/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aeng%3Aready+label%3A%22%F0%9F%90%9E+bug%22 |
Thanks for the link @ekager! I'll be checking out the issues there Still, I'd like to try my hand at custom lint rules, if possible |
Yep feel free! This PR adding the existing lint checks may help, #8946 |
I think a warning on the first line of the file works! |
I have a working version that covers the Kotlin (and Java) source code files, but I think it's not possible to do this with the resource (XML) files. The problem is that after experimenting with the For example, in the following unit test the first child of the
But if the detector runs in a real resource file (with exactly the same contents) it does report a warning (missing license). In this case I'm running it against the After adding some debug output to the warning message I see that it happens because the Besides, the alpha node in the resource file does not have any siblings so we can't access the comment nodes that are outside of the root element. If anyone has any idea on why this is happening, let me know :) Anyways, after running the lint (for Kotlin/Java files) on the |
@juan-goncalves sorry for the very long delay! I'm fine with starting it for just the Kotlin files if you have something working feel free to put up a PR :) |
@ekager I forgot about it! I remember that at least for the Kotlin files it was working fine, let me update the branch (and I'll see if there has been any updates on the lint tools to see if the XML one works too) |
See: #17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
In #8946 I set up a module so we can add our custom lint checks. Adding one where we check licenses could save us some review time and prevent missed licenses.
It looks like we could do something like this to check the comments in a file: https://android.googlesource.com/platform/tools/base/+/studio-master-dev/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/CommentDetector.java
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: