Duplicate code to search only on the same module

Answered

Is there a way to make the duplicate code locator to search for duplicates only on the same module, and not the entire project?

 

Thanks,

3
9 comments

Yes, you can use Custom scope option with the selected module.

0

Hi Serge,

Is there a way to set automatic one (as seen in the screenshot below) to look only in the current module ?

0

You can make this inspection active only for the specified scope, see https://www.jetbrains.com/idea/help/changing-the-order-of-scopes.html.

0

Is there a way to make it to look only in the current module (the module the file I am editing belongs to)? I have looked through all predefined scopes - and I could not find something like that.

I also tried to create a custom scope - but could not find a modifier that be something like "only current module" in https://www.jetbrains.com/idea/help/scopes.html.

Creating a different scope for each module will not work, since it will be essentially the same as All Project (It will look in all of the modules..)

 

 

0

It's not possible to make it work for the current module since inspections do not have the context of what is current. You can make it work for some specific module only.

0

I think this is quite essential. I have some generated code in multiple microservices, and this inspection is incorrectly warning me about duplicates. I want the inspection to never exceed module boundaries, regardless of what is "current".

0

+1 for having a switch: "search for duplicates only in this module"!

4

+1. Was this taken into account ?

0

Please sign in to leave a comment.