Modify Settings of Provided Inspection

I'm trying to find a way to modify the settings of one of the provided inspections (e.g. set the ESlint package of the ESlint inspection) via API.

I've found I can access the inspection tool via:

InspectionProjectProfileManager.getInstance(project).getCurrentProfile().getTools("Eslint", project);

but I can't find a way to access/change its settings. Any pointers on how to do this if it's possible?

 

1

If you would modify this settings in the plugin, how would you distinguish if user changed something and don't want a plugin to override his settings? I think that if you need to change defaults for an inspection, you need an extension point in that inspection. 

Anna

0
Avatar
Permanently deleted user

Thanks for the response Anna. 

This is just for initializing the inspection settings for our in-house developers, for those that haven't done so already. We have a complex process for configuring Eslint and we'd like to automate this as much as possible.

Are you saying that there is no extension point or this can't be done via code?

0

The tool is inside ultimate code base so you don't have access to it. If you need to do it for your team, why not share the configs instead?

Anna

0
Avatar
Permanently deleted user

The ESLint package path is specific to each computer and is located in our build dependencies (after a local build), and varies with each release of our software, so it's not easily shareable. 

Even if it were centralized, is there a way for each user to automatically inherit the ESLint settings from a common place?

0

You can create path variable to point to the installation. It would be used automatically in inspection settings. The inspection settings are saved under .idea directory when profile is marked as project profile.

Anna

0
Avatar
Permanently deleted user

If I'm understanding your response correctly, each user would still need to manually configure each project with the location to a shared package. This is what I was trying to automate.

0

Path variables are set once for instance variable. I don't see how this could work without configuring once when paths are different on different computers.

0
Avatar
Permanently deleted user

There is a programmatic way to modify path variables (if you were meaning doing this through IntelliJ plugin): com.intellij.openapi.application.PathMacros#setMacro

So path variable could be a proxy holding a package path value.

Please note, that if you try paths variable in eslint package field in UI, it would be marked as invalid now, but after project restart the value of path variable will be in this field (it is placed during settings read. probably we should improve it)

0

请先登录再写评论。