Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the Android Studio code analyzer to not return thousands of spelling errors?

I'm using the Android Studio (AS) 3.3.2 to try to revive an old project. Running Analyze > Inspect code... unexpectedly returns a huge number of spelling errors (~8000) for just about everything, not distinguishing between what is code, comments, or XML attributes, etc.

In previous projects, I never encountered this problem and it seems that AS was smart enough to separate code, variables, etc when spell checking. Now it looks like this:

enter image description here

As you can see, there are also other problems. For example with properties files found in both Gradle cache and seemingly from build intermediates:

..\\app\\build\\intermediates\\res\\merged\\debug\\drawable-ldrtl-xxhdpi-v17_abc_ic_menu_copy_mtrl_am_alpha.png.flat

I have also tried to disable 'Typos' in the app/build.gradle under lintOptions{} without any effect. (It seem that this is ignored.)

How can I tune this to behave in a sane way?
(I don't want to turn off spell checking.)

like image 925
not2qubit Avatar asked Apr 01 '19 09:04

not2qubit


1 Answers

"URI is not registered" could be for a few reasons such as:

  • you have added manually activity_emergency_number.xml while being in a specific build variant and it could have been missing some linking configurations for other build variants. A solution here is to try to switch build variants to make Android Studio reload configuration linking.
  • Misleading linking between resources in your Intellij Idea cache. A solution could be to Invalidate and Restart Cache.
  • The folder structure of where activity_emergency_number.xml is located
  • Add your url through Preferences > Languages & Frameworks > Schemas and DTDs > Add(+) > Apply > Ok
  • activity_emergency_number.xml missing header line <?xml version="1.0" encoding="utf-8"?>
  • When you have multiple flavors, make sure that your current selected build variant matches the flavor for the layout activity_emergency_number.xml
  • your attributes in activity_emergency_number.xml views are missing some prefix like android: or have some prefix that aren't needed fr those attributes

About ignoring some spelling typo in situations such as code variables and not ignoring them in other situations such as comments, you have those options available to tune together as well with the Scope you are interested (Production, Test, Project Source Files, Project Files..) in:

Android Studio > Preferences > Editor > Inspections > Spelling > Typo

Here you have two things:

  • Severity (where you define also the Scope)
  • Options
    • Process Code (unselect this to not check typos in code variables)
    • Process Literal (this one you have to try if you will need it)
    • Process Comments (keep this selected to check typos in comment)

enter image description here

like image 89
denis_lor Avatar answered Oct 31 '22 20:10

denis_lor