Skip to content
Snippets Groups Projects

Reduce complexity: replace case statement with method lookup.

Merged gitlab-qa-bot requested to merge github/fork/robbkidd/reduce_note_observer_complexity into master

Created by: robbkidd

Code climate gave NoteObserver a "B" because of the complex notify_team_of_new_note method that used a case statement. According to straight code analysis, this change halves the complexity of the method.

A concrete benefit of this change is that it reduces the number of code changes needed to add an email notification to a Note on a new model--or, say, Snippet with no email currently implemented. One would only have to make changes to Notify (add a note_snippet_email method and view) and update the tests for this method. No further change needed within the method itself.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: rspeicher

    :thumbsup:

    By Administrator on 2012-10-12T00:12:42 (imported from GitLab project)

    By Administrator on 2012-10-12T00:12:42 (imported from GitLab)

  • Created by: riyad

    good idea :)

    By Administrator on 2012-10-12T00:39:06 (imported from GitLab project)

    By Administrator on 2012-10-12T00:39:06 (imported from GitLab)

Please register or sign in to reply
Loading