Qodana - how to set IncorrectHttpHeaderInspection in custom yaml profile

52 views Asked by At

I am trying to create a custom Qodana profile to add custom Http headers to the allowed set. I have autogenerated an xml file in IntelliJ, which looks like this:

<component name="InspectionProjectProfileManager">
  <profile version="1.0">
    <option name="myName" value="Project Default" />
    ...
    <inspection_tool class="IncorrectHttpHeaderInspection" enabled="true" level="WARNING" enabled_by_default="true">
      <option name="customHeaders">
        <set>
          <option value="my-header-1" />
          <option value="my-header-2" />
          <option value="my-header-3" />
        </set>
      </option>
    </inspection_tool>
  </profile>
</component>

This works in my local IntelliJ environment, and I'd like to translate this into my custom Qodana profile yaml file. I have tried following the guide here: https://www.jetbrains.com/help/qodana/custom-profiles.html#Configuration+examples, but I cannot get it to work. My code looks like this:

qodana.yaml

version: "1.0"
linter: jetbrains/qodana-jvm-community:latest
failThreshold: 0
profile:
  path: .qodana/profiles/profile.yaml

.qodana/profiles/profile.yaml

name: "My qodana profile"

baseProfile: qodana.recommended

inspections:
  - inspection: IncorrectHttpHeaderInspection
    options:
      customHeaders: 
        - "my-header-1"
        - "my-header-2"
        - "my-header-3"

I think the issue lies with the <set> operator in the xml file, but I haven't been able to see any examples of how to translate this to the correct yaml format, so I'm left with guessing.

1

There are 1 answers

0
Rodj On BEST ANSWER

Unfortunately, currently yaml profiles don't support setting such options. Here is a feature request for it on the Qodana issue tracker. You can create an XML profile of your own, enable and configure required inspections, export it, and then use it in Qodana instead of the yaml one to make it work.