6

My question is if there is a way to add to lint plugin a custom check which it should warn me about before building a version. For example I want it to check all Cursor, InputStream objects in my code if they are closed, or to check my code for //TODO:, //FIXME:.

Any ideas if there is any kind of way to do that, or even not with Lint Plugin?

Thanks in advance!

hardartcore
  • 16,886
  • 12
  • 75
  • 101

1 Answers1

8

Yes, you can add custom checks; see http://tools.android.com/tips/lint/writing-a-lint-check and http://tools.android.com/tips/lint-custom-rules .

For your specific question, note that there's a new lint check in 21.1 which looks at comments. It doesn't look for TODO or FIXME; instead, it complains if it finds the comment marker "STOPSHIP". If you want to add a rule for todo or fixme, you might want to base it on that check.

Tor Norbye
  • 9,062
  • 3
  • 29
  • 24
  • 1
    Stophip is disabled by default! how can you enable it? Here http://tools.android.com/tips/lint-checks, it says that you should add --enable StopShip. Where can I add that? Is it sufficient to enable it in File > Settings > Project Settings > Inspections ??? – acrespo Nov 03 '15 at 14:25