redmine/redmine

View on GitHub
app/controllers/imports_controller.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method auto_map_fields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def auto_map_fields
    # Try to auto map fields only when settings['enconding'] is present
    # otherwhise, the import fails for non UTF-8 files because the headers
    # cannot be retrieved (Invalid byte sequence in UTF-8)
    return if @import.settings['encoding'].blank?
Severity: Minor
Found in app/controllers/imports_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method settings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def settings
    if request.post? && @import.parse_file
      if @import.total_items == 0
        flash.now[:error] = l(:error_no_data_in_file)
      else
Severity: Minor
Found in app/controllers/imports_controller.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method import_type has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def import_type
    return @import_type if defined? @import_type

    @import_type =
      if @import
Severity: Minor
Found in app/controllers/imports_controller.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method mapping has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def mapping
    @custom_fields = @import.mappable_custom_fields

    if request.get?
      auto_map_fields
Severity: Minor
Found in app/controllers/imports_controller.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    if request.post?
      @current = @import.run(
        :max_items => max_items_per_request,
        :max_time => 10.seconds
Severity: Minor
Found in app/controllers/imports_controller.rb - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

There are no issues that match your filters.

Category
Status