You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When destructuring the data of an object inside one of its methods, the feature-envy rule does not realize that the newly created variables actually belong to the object.
Example:
constforeign={constant1: 5,constant2: 5,constant3: 5};classFoo{privateownStuff={num1: 42,num2: 1337,num3: 1024};// Method "doStuff" uses "foreign" more than its own class "Foo". Extract or Move Method from "doStuff" into "foreign". (no-feature-envy)publicdoStuff(num: number){const{ num1, num2, num3, num4, num5, num6 }=this.ownStuff;returnforeign.constant1+foreign.constant2+foreign.constant3+num1+num2+num3;}// No errorpublicdoOtherStuff(num: number){return(foreign.constant1+foreign.constant2+foreign.constant3+this.ownStuff.num1+this.ownStuff.num2+this.ownStuff.num3);}}
The text was updated successfully, but these errors were encountered:
When destructuring the data of an object inside one of its methods, the feature-envy rule does not realize that the newly created variables actually belong to the object.
Example:
The text was updated successfully, but these errors were encountered: