Back up in the ReportsController, there is still some duplication that needs to be resolved. There are nine methods: 1 controller action (issue_report) 1 private before_filter method (find_project) 7 private utility methods The controller action is ripe for a few refactorings but I wanted to start with the find_project for personal reasons. I used the …
Tag: refactoring
Daily Refactor #9: Move Issue#by methods
Yesterday’s refactoring to the ReportsController helped to move some of the ActiveRecord::Base#select_all methods out of the controller but I was still left with the duplication in the Issue model. Today, I’ll dig into those model methods and remove most of the duplication. The Refactoring Before 1 2 3 4 5 6 7 8 9 10 …
Daily Refactor #8: Move method in the ReportsController
The Refactoring This is the first part to a larger refactoring of the ReportsController in Redmine. This controller is responsible for calculating the total number of issues based on different criteria (e.g. issue status, issue priority). There are two big problems with the current code: It has a lot of duplication, both in the main …
Daily Refactor #7: Extract method in fetch_changesets
Working off of Caliper’s flay report for Redmine, I was able to refactor another code duplication. The Refactoring Redmine supports connecting to seven different source control systems to import their changes (e.g. git, subversion, mercurial). When Redmine runs the import, it adds each Changeset (a commit) into the database and also information about each Change …
Daily Refactor #6: Move recipients method to acts_as_event
This week I’m planning to do some refactoring on Redmine’s code base. Today I fixed a smell that Caliper found with flay. The Refactoring Redmine has several model objects that generate Events, which are listed on it’s Activity Page and cause email notifications to be sent. A few of these models had identical recipients methods …