-1

I can use //noinspection statement to disable suppress some types of code inspection in IDEA IDE (WebStorm, PhpStorm, ...):

// noinspection JSCheckFunctionSignatures

Where can I find a list of all inspections available for this statement?

UPDATE: I'm looking for keywords list for JavaScript.

Alex Gusev
  • 1,526
  • 3
  • 16
  • 35
  • 2
    *"I can use //noinspection statement to disable some types of code inspection*" It's not disabling -- it's suppressing them (they are still run, just not reported for that line/statement). You can insert such comment via Alt+Enter/light bulb menu https://www.jetbrains.com/help/webstorm/disabling-and-enabling-inspections.html#suppress-inspections – LazyOne Oct 23 '21 at 09:48
  • 2
    https://gist.github.com/discordier/ed4b9cba14652e7212f5 .. or look inside the JS plugin file and iterate the inspection names there... – LazyOne Oct 23 '21 at 10:05

2 Answers2

2

Unfortunately, at this time (May 2022) JetBrains does not appear to keep an up-to-date list of inspection IDs (what I'll call shortNames) as part of their public online documentation for all products (e.g. there is a page called List of Java inspections, but it doesn't appear to include the shortNames).

If you are a JetBrains customer and this is something you would like then I would encourage you to send feedback to them with suggestions for how the software could be improved. (e.g. on a community forum or YouTrack).

Thankfully, there are some ways to ascertain these shortNames:

1. Use the context menu

Right-click near the "red squiggle", select "Show Context Actions", click directly on the arrow, and click "Suppress for statement". This should generate a comment above the line, e.g. // noinspection NpmUsedModulesInstalled, which then suppresses the inspection for the following line (making the "red squiggle" go away) context menu in WebStorm IDE highlighting expansion arrow then "suppress for statement" on submenu

Personally, I think having to directly click that arrow symbol is bad UX because it violates the usual convention of the arrow merely signaling that selecting the item, not only the arrow, will open a submenu. Using "..." or "More..." or something would have been more clear. Additionally, it feels inconsistent to have to show an additional menu to reveal the "Suppress ..." options for JetBrains' inspections meanwhile using code quality tools/plugins like eslint causes "Suppress ..." options to be listed on the first level (which, in my opinion, is the most appropriate place for them).

2. Peek at a cheat sheet

Various people have uploaded (unofficial) lists of the inspection names for convenient reference. Here are some:

3. Dig into the IDE's installation files

In my case, I searched through files in my WebStorm installation folder (e.g. C:\Users\me\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\221.5080.193) and found plugins/JavaScriptLanguage/lib/JavaScriptLanguage.jar (which is a compressed archive, using ZIP format, whose contents can can be extracted) and found that the META-INF\plugin.xml file it contained had the information I wanted in the shortName attribute of elements that looked like this:

<localInspection
  language="JavaScript"
  groupPath="JavaScript and TypeScript" 
  shortName="JSRemoveUnnecessaryParentheses"
  key="unnecessary.parentheses.display.name"
  groupKey="js.code.style.issues.group.name"
  enabledByDefault="true"
  level="INFORMATION"
  cleanupTool="true"
  implementationClass="com.intellij.lang.javascript.inspections.JSRemoveUnnecessaryParenthesesInspection"
/>
jacobq
  • 11,209
  • 4
  • 40
  • 71
1

The website of the IDEA IDE has a page listing these:

Disable and suppress inspections

https://www.jetbrains.com/help/pycharm/2019.1/disabling-and-enabling-inspections.html

Andrew
  • 2,046
  • 1
  • 24
  • 37
  • Any idea where I can find a similar list for WebStorm / JS? I looked in what I thought was the equivalent documentation (https://www.jetbrains.com/help/webstorm/disabling-and-enabling-inspections.html#suppress-inspections) but cannot find them anywhere. – jacobq May 18 '22 at 21:06
  • Nevermind, I found what I needed here: https://gist.github.com/discordier/ed4b9cba14652e7212f5 – jacobq May 19 '22 at 15:26