Its very easy to remove unnecessary imports and characters while saving a file in eclipse.This will help to avoid sonar issues in our code base.

go to eclipse-> preferences->Java -> Editor->Save Actions and give the below checkbox options as looks in picture below.




also do the advanced level setting by clicking configure button