0

is there a way to disable a specified severities visibility for code inspection? The intention is that it is not shown in inspection summaries.

I think about a "do not show" warning like in Resharper? -> Resharper-DOC

Thanks

EDIT: I just don't want to see a specific severity in inspection summary. So let's say, I have 200 "Weak Warnings", 40 "Could be more performant" and 100 "INFO" entries. This could be done with 3 predifined severities. After inspection, as summary, I see the list of warnings grouped by this severities. My intention now is that I only want to see "Weak Warnings" and "Could be more performant", all warnings specified by the severity of "INFO" should not be shown in the result.

The goal here is not the non visibility in the IDEA GUI the further goal is that this entries are ignored in the IDEA offline Inspection, but if I can manage to change the Inspectionprofile in a way that some severities are completely ignored, in GUI, the resulting files from offline inspections will get more clear too.

Hopefully that's enough to explain my problem further.

EDIT:

Disabled for some testing

<inspection_tool class="Annotator" enabled="true" level="ERROR" enabled_by_default="true">
  <scope name="jmf.properties" level="WEAK WARNING" enabled="false" />
  <scope name="LicenseFiles" level="IGNORE" enabled="false" />
</inspection_tool>

Now LicenseFiles Scope is shown as "Weak Warning" although it's disabled, very interesting. The Scopes are the right ones, but it doesn't seem to work as it should.

The "Weak Warning" Severity shouldn't be listed here.

Scope Definition

Stefan Sprenger
  • 1,050
  • 20
  • 42

2 Answers2

1

Inspection profiles are stored as .xml files in the .idea directory for project-level profiles and in the settings directory for application-level profiles. You can create a copy of your inspection profile and do a batch search and replace of

enabled="true" level="INFO"

to

enabled="false" level="INFO"

(substituting your own severity if you need). This should do what you need.

yole
  • 92,896
  • 20
  • 260
  • 197
  • :O have you tested this? I thought this option is just for enabling/disabling the whole severity itself? – Stefan Sprenger Dec 23 '14 at 21:54
  • There is no such thing as "disabling a severity". Also, the inspection profile has many tags, and this pattern matches the attributes of those tags. So you'll see quite clearly that you'll be disabling individual inspections. – yole Dec 23 '14 at 22:11
  • Edited question, troubles won't stop – Stefan Sprenger Jan 08 '15 at 09:42
  • I don't believe that editing the question to describe a different situation and unaccepting the answer because it no longer fits is the way StackOverflow is supposed to work. – yole Jan 09 '15 at 08:17
  • https://youtrack.jetbrains.com/issue/IDEA-135031#u=1420711597014 Also not validating that something works in a way, while it's a bug, but for gods sake. – Stefan Sprenger Jan 15 '15 at 08:21
0

I agree with @yole that your question is not very clear. That said, in addition to the suggestion @yole made, you can also create a custom inspection level that in turn has custom highlighting configuration. Open the inspection settings (its in the "editor" group in IDEA v14). Select an inspection. In the right pane, there will be a "severity" setting. In the drop down is an "Edit Severity settings" option. Select that and then create a new severity level. You can then set the in editor highlighting format (or set to none) and the error stripe color (or turn it off). Once you've created your custom level, set any inspections desired to that level.

If you simply want to limit what inspections show when you run the Analyze > Inspect Code action, you would need to create an additional inspection profile with just the inspections you want to run turned on, or with alternate severity levels. Then choose that profile in the dialog when you run the Analyze > Inspect Code action.

Javaru
  • 30,412
  • 11
  • 93
  • 70