Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Code Cleanup..." feature of Android Studio v2.2.2

In Android Studio v2.2.2, Code Cleanup feature available under Analyze option.

Analyze >> Code Cleanup 

What this option exactly do with code ?

Please explain in details.

like image 568
Priyank Patel Avatar asked Dec 08 '16 06:12

Priyank Patel


People also ask

What is code clean up in Android Studio?

After inspection of code, Android Studio will remove such code from your files that is not necessary. It is called cleaning up code. There are many plugins available for it. As Android Studio support by default, You can format and clean your code using this feature.

What does code clean up do?

Code cleanup refers to the act of writing code so that it cleans up leftover data structures and other unwanted materials from memory and the filesystem. It is sometimes treated as a synonym of refactoring code, which involves making the source code itself easier to understand, maintain, and modify.

How do you code cleanup?

You can also run code cleanup across your entire project or solution. Right-click on the project or solution name in Solution Explorer, select Analyze and Code Cleanup, and then select Run Code Cleanup.

What does Intellij cleanup code do?

Code cleanup helps apply formatting rules and many other code style preferences in a bulk mode for the desired scope. Most of your code style preferences are taken into account when JetBrains Rider produces new code with code completion and code generation features, applies code templates and performs refactorings.


1 Answers

When you clean up your code using 'Android Studio', It start inspecting code defined rules.

For list of defined rules check, File -> Settings -> Editor -> Inspection. (For Mac, Android Studio -> Preferences -> Editor -> Inspection) Here you can find all rules like,

  1. non-used variables,
  2. non-used import,
  3. Abstaraction issues,
  4. Code style issues,
  5. Java Beans issues etc.

After inspection of code, Android Studio will remove such code from your files that is not necessary. It is called cleaning up code.

There are many plugins available for it. As Android Studio support by default, You can format and clean your code using this feature.

like image 170
AndiGeeky Avatar answered Sep 17 '22 15:09

AndiGeeky