I use WebStorm and other JetBrains projects.
I am looking for a command line tool that can modify the settings for a new project so that I don't have to do it manually.
For example, I never want spellcheck to be active, and I believe this is the XML that controls spellcheck:
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>
Does anyone know of a JetBrains tool that can do this, or should I write something myself?
The right way to do this will be for each user to modify the Default Settings of JetBrains products themselves.
https://www.jetbrains.com/help/webstorm/accessing-default-settings.html
However, I am still curious if there is a good way to use/create a command line to tool to change per project settings.
If you know XPath, another option is to use xmlstarlet. Specifically, the ed (edit) command.
Example command line...
xmlstarlet ed -u "//inspection_tool[@class='SpellCheckingInspection']/@enabled" -v "false" some_settings_file.xml
results...
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default"/>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true"/>
<option name="processLiterals" value="true"/>
<option name="processComments" value="true"/>
</inspection_tool>
</profile>
</component>
You can also edit the file in-place by adding -L (xmlstarlet ed -L ...).
Does it really have to be a command-line tool? Why don't you just use IDEA's on-board means?
Enter the inspections dialog in the settings. Then export, import, duplicate (with special name like "MyCompany default") all inspection settings to/from XML.

Select "File" - "Other settings" - "Default settings", then deactivate the spelling inspection (similar to screenshot above) and save.
Now just export all (or your own subset of) default settings into an importable JAR file via "File" - "Export settings". This has the advantage that you can bundle a package of default settings, e.g. code style, colors, toolbar buttons, file templates and many more. The minimum your need to export are "Default project" and "Inspection profiles (schemes)".

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With