Showing 529 of 529 total issues

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

  def create
    begin
      @usage_term = UsageTerm.create! usage_term_params
      redirect_to app_admin_usage_term_path(@usage_term), flash: {success: "A new usage_term has been created."}
    rescue => e
Severity: Minor
Found in app/controllers/app_admin/usage_terms_controller.rb and 2 other locations - About 25 mins to fix
app/controllers/app_admin/groups_controller.rb on lines 75..81
app/controllers/app_admin/permission_presets_controller.rb on lines 28..36

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 29.

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 2 locations. Consider refactoring.
Open

    def self.map_to_media_type(content_type)
      unless content_type
        "other"
      else
        case content_type
Severity: Minor
Found in app/models/concerns/media_type.rb and 1 other location - About 25 mins to fix
app/models/media_file.rb on lines 53..69

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 29.

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 10 locations. Consider refactoring.
Open

  scope :text_rank_search, lambda{|search_term| 
    rank= text_search_rank :searchable, search_term
    select("#{'groups.*,' if select_values.empty?}  #{rank} AS search_rank") \
      .where("#{rank} > 0.05") \
      .reorder("search_rank DESC") }
Severity: Major
Found in app/models/group.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 4 locations. Consider refactoring.
Open

  def error_application    # handles 'Error'
    msg = "Entschuldigung, ein allgemeiner Fehler ist aufgetreten." 
    respond_to do |format|
      format.html { flash[:error] = msg ; redirect_back_or_root }
      format.json { render :json => {error: msg}, status: 500}
Severity: Minor
Found in app/controllers/application_controller.rb and 3 other locations - About 20 mins to fix
app/controllers/application_controller.rb on lines 154..158
app/controllers/application_controller.rb on lines 162..166
app/controllers/application_controller.rb on lines 170..174

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 28.

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 10 locations. Consider refactoring.
Open

      scope :text_rank_search, lambda{|search_term| 
        rank= text_search_rank :searchable, search_term
        select("#{'users.*,' if select_values.empty?}  #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/user_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 10 locations. Consider refactoring.
Open

      scope :trgm_rank_search, lambda{|search_term| 
        rank= trgm_search_rank :term, search_term
        select("#{'keyword_terms.*,' if select_values.empty?} #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/keyword_term_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 10 locations. Consider refactoring.
Open

  scope :text_rank_search, lambda{|search_term| 
    rank= text_search_rank :term, search_term
    select("#{'meta_terms.*,' if select_values.empty?}  #{rank} AS search_rank") \
      .where("#{rank} > 0.05") \
      .reorder("search_rank DESC") }
Severity: Major
Found in app/models/meta_term.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 10 locations. Consider refactoring.
Open

      scope :trgm_rank_search, lambda{|search_term| 
        rank= trgm_search_rank :searchable, search_term
        select("#{'people.*,' if select_values.empty?} #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/person_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 10 locations. Consider refactoring.
Open

  scope :trgm_rank_search, lambda{|search_term| 
    rank= trgm_search_rank :term, search_term
    select("#{'meta_terms.*,' if select_values.empty?} #{rank} AS search_rank") \
      .where("#{rank} > 0.05") \
      .reorder("search_rank DESC") }
Severity: Major
Found in app/models/meta_term.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 2 locations. Consider refactoring.
Open

      media_resource_ids.each do |mr_id| 
        existing_gp_group_ids = Set.new Grouppermission.where("media_resource_id= ?",mr_id).pluck(:group_id)
        (existing_gp_group_ids - affected_group_ids).each do |gid|
          Grouppermission.find_by(media_resource_id: mr_id,group_id: gid).destroy
Severity: Minor
Found in app/controllers/permissions_controller.rb and 1 other location - About 20 mins to fix
app/controllers/permissions_controller.rb on lines 49..52

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 28.

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 10 locations. Consider refactoring.
Open

  scope :trgm_rank_search, lambda{|search_term| 
    rank= trgm_search_rank :searchable, search_term
    select("#{'groups.*,' if select_values.empty?} #{rank} AS search_rank") \
      .where("#{rank} > 0.05") \
      .reorder("search_rank DESC") }
Severity: Major
Found in app/models/group.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 10 locations. Consider refactoring.
Open

      scope :trgm_rank_search, lambda{|search_term| 
        rank= trgm_search_rank :trgm_searchable, search_term
        select("#{'users.*,' if select_values.empty?} #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/user_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20

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 28.

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 10 locations. Consider refactoring.
Open

      scope :text_rank_search, lambda{|search_term| 
        rank= text_search_rank :searchable, search_term
        select("#{'people.*,' if select_values.empty?}  #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/person_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 9..13
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 4 locations. Consider refactoring.
Open

  def error_unprocessable_entity # handles 'UnprocessableEntityError'
    msg = "Unprocessable entity error message." 
    respond_to do |format|
      format.html { flash[:error] = msg ; redirect_back_or_root }
      format.json { render :json => {error: msg}, status: :unprocessable_entity}
Severity: Minor
Found in app/controllers/application_controller.rb and 3 other locations - About 20 mins to fix
app/controllers/application_controller.rb on lines 137..141
app/controllers/application_controller.rb on lines 154..158
app/controllers/application_controller.rb on lines 170..174

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 28.

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 4 locations. Consider refactoring.
Open

  def error_not_allowed # handles 'NotAllowedError'
    msg = "Not allowed error message." 
    respond_to do |format|
      format.html { flash[:error] = msg ; redirect_back_or_root }
      format.json { render :json => {error: msg}, status: :not_allowed}
Severity: Minor
Found in app/controllers/application_controller.rb and 3 other locations - About 20 mins to fix
app/controllers/application_controller.rb on lines 137..141
app/controllers/application_controller.rb on lines 154..158
app/controllers/application_controller.rb on lines 162..166

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 28.

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 10 locations. Consider refactoring.
Open

      scope :text_rank_search, lambda{|search_term| 
        rank= text_search_rank :term, search_term
        select("#{'keyword_terms.*,' if select_values.empty?}  #{rank} AS search_rank") \
          .where("#{rank} > 0.05") \
          .reorder("search_rank DESC") }
Severity: Major
Found in app/models/keyword_term_modules/text_search.rb and 9 other locations - About 20 mins to fix
app/models/group.rb on lines 46..50
app/models/group.rb on lines 52..56
app/models/keyword_term_modules/text_search.rb on lines 15..19
app/models/meta_term.rb on lines 75..79
app/models/meta_term.rb on lines 81..85
app/models/person_modules/text_search.rb on lines 23..27
app/models/person_modules/text_search.rb on lines 29..33
app/models/user_modules/text_search.rb on lines 16..20
app/models/user_modules/text_search.rb on lines 22..26

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 28.

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 4 locations. Consider refactoring.
Open

  def error_user_forbidden # handles 'UserForbiddenError'
    msg = "Sie haben nicht die notwendige Zugriffsberechtigung." 
    respond_to do |format|
      format.html { flash[:error] = msg ; redirect_back_or_root }
      format.json { render :json => {error: msg}, status: :not_authorized}
Severity: Minor
Found in app/controllers/application_controller.rb and 3 other locations - About 20 mins to fix
app/controllers/application_controller.rb on lines 137..141
app/controllers/application_controller.rb on lines 162..166
app/controllers/application_controller.rb on lines 170..174

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 28.

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 2 locations. Consider refactoring.
Open

      media_resource_ids.each do |mr_id| 
        existing_up_user_ids = Set.new Userpermission.where("media_resource_id= ?",mr_id).pluck(:user_id)
        (existing_up_user_ids - affected_user_ids).each do |uid|
          Userpermission.find_by(media_resource_id: mr_id, user_id: uid).destroy
Severity: Minor
Found in app/controllers/permissions_controller.rb and 1 other location - About 20 mins to fix
app/controllers/permissions_controller.rb on lines 68..71

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 28.

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

    after(:create) do |me| 
      meta_key = MetaKey.find_by_id(:title) || FactoryGirl.create(:meta_key_title)
      me.meta_data.create meta_key: meta_key, value: Faker::Lorem.words[0]
      me.reindex
Severity: Minor
Found in factories/media_resource.rb and 2 other locations - About 20 mins to fix
factories/media_resource.rb on lines 7..10
factories/media_resource.rb on lines 75..78

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 27.

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 2 locations. Consider refactoring.
Open

  def create
    begin
      @meta_key = MetaKey.create(new_meta_key_params)
      redirect_to app_admin_meta_keys_url, flash: {success: "A new meta key has been created"}
    rescue => e
Severity: Minor
Found in app/controllers/app_admin/meta_keys_controller.rb and 1 other location - About 20 mins to fix
app/controllers/app_admin/context_groups_controller.rb on lines 23..29

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 27.

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

Severity
Category
Status
Source
Language