The Refactoring The flay report on Caliper shows that IssuesHelper#show_detail has the most duplicated code in Redmine, specifically inside of a long case statement. The first step I took was to extract a new method from the body of the case statement. Before 1 2 3 4 5 6 7 8 9 10 11 12 …
Tag: move-method
Daily Refactor #30: Move Method into Issue
The Refactoring Today is the day that I finally get to finish the set of refactorings I started back on the 24th. My goal was to start converting the IssuesController into a skinny controller by moving code into the models. Today, I finally was able to cleanly move #issue_update from the controller into the Issue …
Daily Refactor #27: Move Method to the Attachment Model
The Refactoring Today I used move method to refactor part of Redmine that had a TODO comment since 2007. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # app/controllers/application_controller.rb class ApplicationController 0 a = Attachment.create(:container => obj, :file => file, :description => attachment['description'].to_s.strip, :author => User.current) a.new_record? …
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 #21: Move methods in the RoutingTest
I tried to start this week’s refactorings with some major changes to one of the worst areas of Redmine, the IssuesController. Weighing in at over 576 lines and 20 actions, it is full of really bad smells and hasn’t getting any better over time. But after spending two hours on it, I was getting nowhere …