The Refactoring AuthSourceLdap#authenticate still can use some more refactoring. I performed another extract method, this time to create a method to authenticate an DN (Distinguished Name). Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter …
Tag: extract-method
Daily Refactor #17: Extract method in AuthSourceLdap
Since I’ve been doing a lot of work on a Redmine plugin to add more LDAP features, I decided to use today to refactor some of Redmine’s LDAP code. The Refactoring I just performed a simple extract method refactoring on the authenticate method in AuthSourceLdap to make it easier to understand what it does with …
Daily Refactor #14: Extract method to before_filter in ReportsController
The Refactoring I started on a larger refactoring of the issue_report_details method today but found a potential security bug so I threw it away. It’s better to be secure than refactored :) So instead, I performed a common Rails refactoring for removing duplicate code: extracting some code to a before filter. Before 1 2 3 …
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 #4: Extract Method in the BulkTimeEntriesHelper – options generator
Today Devver team showed me a new feature they added to their Caliper project, the flay code view. I liked it so much I used it on today’s BulkTimeEntry plugin refactoring. The Refactoring Flay is a tool that checks for duplicated Ruby code. The BulkTimeEntry plugin only showed one piece of code that was duplicated …