Remove code climate duplication code