coala / coala-bears

Bears for coala
https://coala.io/
GNU Affero General Public License v3.0
295 stars 580 forks source link

Bear Proposal: detekt #2215

Open jayvdb opened 6 years ago

jayvdb commented 6 years ago

https://github.com/arturbosch/detekt

CaptainDredge commented 6 years ago

I would like to take up this issue!! It'll have a steep learning curve. Can you plz guide me how should I go about doing it? @jayvdb

Makman2 commented 6 years ago

@Prabhat-IIT please look into our docs.

gitmate-bot commented 6 years ago

This issue seems stale!

@Prabhat-IIT please reassign yourself if you're still working on this.

(Powered by GitMate.io)

SergeiGorbatiuk commented 6 years ago

@jayvdb , I would like to try myself on this issue, as it seems that no one is working on it now ;)

jayvdb commented 6 years ago

Ya, this one is better. Note that this linter works on the project level, not on individual files, so this needs to be a GlobalBear.

SergeiGorbatiuk commented 6 years ago

@jayvdb , @Makman2 , hello! After long struggles I have finally built the detekt from source repo and now I am facing a problem: If I am right, to start the detekt analyzer I have to call it from terminal with an expression like java -jar detekt-cli/build/libs/detekt-cli-[version]-all.jar [args]. So what is the proper way to wrap it in linter class, I mean, what parameter should go to executable, and which - to the create_arguments function? In the tutorial there is considered an example with callable directly from terminal Pylint, but here is another situation and I am a bit stuck :( Or maybe I misunderstand something about it?

Makman2 commented 6 years ago

I guess your callable is here java then ;) Just because your bear is called DetektBear, it doesn't mean it has to call an executable detekt or similar ;) However a problem is here how the jar is made available to the user, because normally you have to pass an explicit path to it.

Makman2 commented 6 years ago

Just thinking: Is it not possible to download a ready built detekt jar from some source? Then you don't have to build it^^

But to handle the jar problem, I have an idea: Bears can currently save files into a bear-specific directory. We could automate downloading the jar into the bear-specific directory and use it. In case detekt is not available for download, we could instead download the sources and build them during initialization of the bear.

Btw: There's an issue out there to put detekt on Maven Central, this would probably simplify things a lot: https://github.com/arturbosch/detekt/issues/345

SergeiGorbatiuk commented 6 years ago

@Makman2 where can I find additional info about that directory you talking about and initialization of bear?) Well, actually build takes quite a lot of time and sources are not lightweight. Maybe for now we could somehow provide already built jar, waiting for the issue you referenced to be resolved?)

Makman2 commented 6 years ago

Well, actually build takes quite a lot of time and sources are not lightweight.

How long did it take and what were the major components you had to install? I mean java itself is not really lightweight which we have to run with detekt ;)

Maybe for now we could somehow provide already built jar, waiting for the issue you referenced to be resolved?

Then we should drive the issue instead, so we can download the jar then and others too. If it's too complicated we work around and provide our own download^^ we actually have misused a repo on GitHub to host a few of such artifacts^^

where can I find additional info about that directory you talking about and initialization of bear?

If it's not described in the bear writing guides, it's definitely mentioned in the API docs.

SergeiGorbatiuk commented 6 years ago

I have built it from source repo following build notes, and actually I have no idea what components are used to do it. It took around 2 minutes to finish. As I understand, maintainer assigned this issue to himself and there is no definite deadline or work going on as of now, cause he has lots of other things to do :(

Makman2 commented 6 years ago

It took around 2 minutes to finish.

That's long, but bearable imo. A good message indicating that it might take a few minuts makes the user satisfied I guess :)

As I understand, maintainer assigned this issue to himself and there is no definite deadline or work going on as of now, cause he has lots of other things to do :(

Since he's not working on it anyway now, I think that doesn't mean much that he's assigned. In the end we could just do it (if we really want to) and submit a PR.

SergeiGorbatiuk commented 6 years ago

@Makman2 , hello! I wanted to say that now I am having exams in my university and I am not able to work on this issue, I am telling just in order to not making it a hanging one. I would like to return to it, but when I have more time :( May our notes here be hints for them who would also want to try this one =)

Makman2 commented 6 years ago

Thanks for telling ;)

jayvdb commented 5 years ago

This issue reserved for Google Code-in task 5850142298079232.