Can I script installation of custom inspection profiles?

Answered

My repository has .idea/inspectionProfiles/Project_Default.xml committed to source control. I'd like to make my own profile, without modifying the controlled version and having diffs show up in git diff.

Is there a way for me to programmatically "import" or "apply"  custom IntelliJ inspection profile? I have some custom install scripts that can move my custom profile XML into .idea/inspectionProfiles/msenn.xml (instead of Project_Default.xml) , but I can't figure out how to "switch" intellij into the profile in an automated way. Right now, I can switch to it in the GUI settings menus. I think I also need a way to “import” code styles into .idea/codeStyles

I'd like to automate this because we use IntelliJ IDEA VMs, which I refresh and re-setup with my preferences about once a week. So scripting would save me a little time.

1
5 comments

Hello Mike Senn 

There is a way to script/automate the activation of inspection profiles and code styles, though it's not well-documented in the official documentation and is not supported by JetBrains. You could follow the article How to Script Installation and Activation of Custom Inspection Profiles and CodeStyles to achieve this.

It was tested in 2025.2.3

0

Hi Monica,

the link you posted above does not seem to work.

0

Hi Mike Senn 

Sorry for the missing link; it is now corrected. You can check it out.

0

Thank you! I will use these files to control the active profiles and styles files.

 .idea/inspectionProfiles/custom_profile.xml
 .idea/inspectionProfiles/profiles_settings.xml - configures custom_profile as active
 .idea/codeStyles/CustomCodeStyle.xml
 .idea/codeStyles/codeStyleConfig.xml - configures CustomCodeStyle as active

0

Hi Mike Senn 

Please let me know if you need further assistance. My project was very simple, but if you need, I can share it.

Have a great day!

0

Please sign in to leave a comment.