Identifying orphaned attributes

#1

Hi fellow Chef gurus!,

I'm refactoring recipes and attributes in a large cookbook and will probably end up with attributes not required somewhere.

Is there a command that checks for this at all? I've seen " chef show-policy" that checks orphaned policies but couldn't see anything for attributes - if there is apologies but cannot see.

How does everyone else review their cookbooks and remove redundant code like that?

many thanks in advance for anyone that can assist.

David

0 Likes

#2

You could potentially use pry to list the attributes that are set and compare it to the list of attributes you have. I am not aware of any automated tool that would identity unused attributes. You could potentially search your code base for references to the attributes using a for loop and a list of attributes.

0 Likes