The Refactoring This refactoring is what I call the magic trick refactor; it looks like a lot is going on but in reality it’s just smoke and mirrors! Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 …
Tag: extract-method
Daily Refactor #23: Extract method in IssuesController#edit
After yesterday’s refactor of the #bulk_edit method, Jean-Philippe Lang finished the refactoring by merging the temporary method I created in the model (Issue#bulk_edit) and simplifying the parameter attributes. Back to the drawing board, it looks like the method with the next highest flog score is #edit. #edit is a pretty complex action in Redmine, since …
Daily Refactor #22: Move method in IssuesController#bulk_edit
I started to refactor the IssuesController today. Like I said yesterday, this class is full of bad smells and could really use some major rework. Picking a good place to start is overwhelming so I turned to a useful tool called flog. Flog is a tool that I use to find out how complex a …
Daily Refactor #20.1: Bonus Extract Method in AuthSourceLdap
Right after publishing the final refactoring for AuthSourceLdap, another really good one jumped out at me and I couldn’t wait until next week to fix it. The Refactoring Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter => object_filter …
Daily Refactor #20: Extract Method in AuthSourceLdap
The Refactoring I mentioned yesterday that I wanted to refactor the ternary operation in the ldap_con#search call so today I used extract method to pull it out. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter => object_filter …