loadsmart / danger-android_lint

A Danger plugin for Android Lint
https://developer.android.com/studio/write/lint.html
MIT License
55 stars 24 forks source link

REPORT_FILE is in the wrong location for me #1

Closed churowa closed 7 years ago

churowa commented 7 years ago

I notice that the plugin is looking for REPORT_FILE in "app/build/reports/lint/lint-result.xml".

But my report file is at app/build/outputs/lint-results*.xml. Is there a way to change where REPORT_FILE points to? I'm getting errors on lint.

Thanks!

barbosa commented 7 years ago

Hey @churowa.

Thanks for asking!

Currently there's no way to change it. You would have to change your gradle file to achieve that, via the xmlOutput option.

But I think this is something we should have. Maybe a xmlFile parameter so we'd have something like:

android_lint.xmlFile = "path/of/your/report/file.xml" # overrides default REPORT_FILE value
android_lint.lint

What do you think?

churowa commented 7 years ago

That sounds pretty good! Do you want me to have a shot at it?

churowa commented 7 years ago

For now, I've worked around it by linting through gradle first, then copying my output file to the REPORT_FILE location. Pretty hacky because I end up running lint twice per build, but it gets the job done!

barbosa commented 7 years ago

@churowa if you have some time to do it, I would love it!

Let me know in case you need any help.

Cheers!

churowa commented 7 years ago

@barbosa Ok! I've forked the project and am giving it go. Please bear with me, I'm pretty new in rubyland.

So the first thing.. after cloning and installing gems, I ran bundle exec rake spec as suggested. I see:

6 files inspected, 87 offenses detected
RuboCop failed!

Are these just warnings? Can I ignore these [edit] for now [/edit] ?

churowa commented 7 years ago

Ok, from what I can tell, Rubocop is mainly used for style issues.. so safe to ignore those 'offenses' for now, I suppose. :)

barbosa commented 7 years ago

That's correct! Just ignore it for now.

I need to clean it up later 😬

churowa commented 7 years ago

Ok, PR created. Pretty sure I need to add some tests or something though. I'll close this issue for now.

ghost commented 7 years ago

@churowa I done as per your mentioned hack. Still I get error for wrong path. I already have file on that path. Can you brefily explain me, what steps you were followed to achieve this??

barbosa commented 7 years ago

Hi @milind-mevada-stl

All you need to do is to pass a value to report_file, like:

android_lint.report_file = "your/report/file.xml"
android_lint.lint

You can find its definition here. If you still can't make it work, would you mind pasting your sample code here so we can help you? Maybe in another issue so we can discuss it there.

ghost commented 7 years ago

Thanks @barbosa . Now it's working.

anthonymonori commented 6 years ago

This should be included in the README! Cheers!

barbosa commented 6 years ago

@anthonymonori I could swear it was already there.

Thanks for the heads up! Just added it.