Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Inspect Code - Exclude generated files

Is there any way, how to exclude android generated files (or manually specify excluded folders), from Analyze -> Inspect Code ?

like image 693
Marek Sebera Avatar asked Sep 05 '13 17:09

Marek Sebera


4 Answers

Use a custom scope. After clicking Analyze > Inspect Code, from the Specify Inspection Scope dialog, click "..." after "Custom scope". Define a new scope. Recursively include Android, app, and whatever else is important. Then recursively exclude folders you don't want.

I like to put my generated code in the build folder and exclude it. (To get code in the build folder to be included in the build, include it in app.gradle in android/sourceSets/main/java.srcDirs.)

like image 74
Edward Brey Avatar answered Nov 16 '22 23:11

Edward Brey


I've found answer

Excluded folders won't be taken in account for Code Analysis

  • Right-click on top-level element and go to Open Module Settings
  • There you have listed single modules, select correct module
  • In right column select folders to be excluded and either right click -> exclude or button exclude above the file tree
  • In left column remove all leftover references to excluded directories from other groups than Excluded Folders

Excluding folders

like image 31
Marek Sebera Avatar answered Nov 16 '22 22:11

Marek Sebera


You can do it using the Gradle IDEA plugin:

apply plugin: 'idea'
idea {
    module {
        excludeDirs = [file("unwanted-directory-name")]
    }
}
like image 2
pomo Avatar answered Nov 16 '22 22:11

pomo


Take a look at this answer:

You basically just create a custom scope with the following pattern: !file:*intermediates*/&&!file:*generated*/&&!lib:*..*

Hope this helps.

like image 1
Henrique de Sousa Avatar answered Nov 16 '22 23:11

Henrique de Sousa