Friendship that leads one to Allah's disobedience is not worth it. Ibn Qudamah Al-Maqdisi mentions in his book Mukhtasar Minhaj Al-Qasidin (pg.126-132) some valuable points on his topic :
Know that not everyone is suitable to be your friend.You must verify that this potential friend has the neccessary characteristics that make friendship with him something to be desired.The one you seek to befriend must have five characteristics:
must be intelligent, as there is no good in befriending an idiot, as he will only harm you when he wants to benefit you.by intelligent, we mean one who understands things as they are, either on his own or if they are explained to him.
must have a good manners, and this is a must. One who os simply intelligent might be overcome by anger or desire, and obey his desire.thus, there would be no benefit in befriending him.
must not be a fasiq, the one who openly disobeys Allah, as such a person would not fear Allah, and whoever does not fear Allah cannot be trusted.
must not be an innovator, as his over indulgence innovation is feared from befriending him.
should not be too eager in seeking the dunya.which means that he i willing to sacrifice his hereafter for it.
nota pipi : this article taken from lessong of the day~gamsahamnida!