Disable spelling checking inspection for specific file types?


I just ran the spelling inspection on a large project. This project contains a huge number of test data files, which the spelling inspection doesn't like. I'm getting over 100K typo warnings on them.

Is there any way to restrict spelling checking to only .java and .groovy files?


1 comment
Comment actions Permalink

Yes. The spelling inspection allows you to set a scope to check.

  1. In the Settings dialog, go to the scope options (it's in the "Appearance & Behavior" section in IDEA 14)
  2. Click the add button and select whether it is a local scope or shared
    • Shared scopes are saved in the .idea/scope directory so they can be shared via version control. (It also makes it easy to copy them to other projects if desired.) local scopes are saved in the .idea/workspace.xml file
  3. Name it as desired.
  4. For the pattern enter something like file:*.java||file:*.groovy
    • Alternatively, you could create a scope that recursively excludes your test data directory. For example !file:src/test/resources/testData//* will exclude all the files and sub-directories in the src/test/resources/testData directory. If you wanted to include testData directories in both main and test, you could use !file:src/**/resources/testData//*
    • Click the help button for more information on the scope pattern syntax
  5. Click Apply to save the scope.
  6. Open the spelling inspection
    • Easiest way is to go to the "Spelling" node in settings (under "Editor" group in IDEA 14) and click the "Configure 'Spelling' inspection" link at the top
    • Or go to the "Inspections" node and search for or locate the "Spelling" inspection
  7. On the right, next to where you set the severity, there is a drop down to select the scope. Select the scope you just created and configure the severity for it.
  8. Click OK and enjoy.

Please sign in to leave a comment.