remomueller/tasktracker

View on GitHub
app/controllers/internal_controller.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for search is too high. [24.27/15]
Open

  def search
    @projects = current_user.all_viewable_projects.search(params[:search]).order('name').limit(10)
    @groups = current_user.all_viewable_groups.search(params[:search]).order('description').limit(10)
    @objects = @projects + @groups
    if @objects.empty?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for toggle_tag_selection is too high. [21.12/15]
Open

  def toggle_tag_selection
    tag_filter = current_user.tag_filters.find_by tag_id: params[:tag_id]
    if tag_filter
      tag_filter.destroy
    elsif params[:tag_id].blank?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for toggle_project_selection is too high. [21.12/15]
Open

  def toggle_project_selection
    project_filter = current_user.project_filters.find_by project_id: params[:project_id]
    if project_filter
      project_filter.destroy
    elsif params[:project_id].blank?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for toggle_owner_selection is too high. [21.12/15]
Open

  def toggle_owner_selection
    owner_filter = current_user.owner_filters.find_by owner_id: params[:owner_id]
    if owner_filter
      owner_filter.destroy
    elsif params[:owner_id].blank?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for update_task_status is too high. [16.12/15]
Open

  def update_task_status
    if params[:status] == 'all'
      current_user.update calendar_task_status: nil
    elsif params[:status] == 'completed'
      current_user.update calendar_task_status: true

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  def toggle_tag_selection
    tag_filter = current_user.tag_filters.find_by tag_id: params[:tag_id]
    if tag_filter
      tag_filter.destroy
    elsif params[:tag_id].blank?
Severity: Major
Found in app/controllers/internal_controller.rb and 2 other locations - About 40 mins to fix
app/controllers/internal_controller.rb on lines 41..50
app/controllers/internal_controller.rb on lines 53..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  def toggle_project_selection
    project_filter = current_user.project_filters.find_by project_id: params[:project_id]
    if project_filter
      project_filter.destroy
    elsif params[:project_id].blank?
Severity: Major
Found in app/controllers/internal_controller.rb and 2 other locations - About 40 mins to fix
app/controllers/internal_controller.rb on lines 29..38
app/controllers/internal_controller.rb on lines 41..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  def toggle_owner_selection
    owner_filter = current_user.owner_filters.find_by owner_id: params[:owner_id]
    if owner_filter
      owner_filter.destroy
    elsif params[:owner_id].blank?
Severity: Major
Found in app/controllers/internal_controller.rb and 2 other locations - About 40 mins to fix
app/controllers/internal_controller.rb on lines 29..38
app/controllers/internal_controller.rb on lines 53..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status