openjaf/cenit

View on GitHub
app/models/setup/mapping_converter.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method validates_mapping has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

    def validates_mapping
      mapping.validate
      unless mapping.errors.present?
        map_model.for_each_association do |a|
          name = a[:name]
Severity: Minor
Found in app/models/setup/mapping_converter.rb - About 1 day 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 write_attribute has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    def write_attribute(name, value)
      if name.to_s == 'map_attributes'
        value.delete('_type')
        value.delete(:_type)
        value.each do |k, v|
Severity: Minor
Found in app/models/setup/mapping_converter.rb - About 7 hrs 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

File mapping_converter.rb has 464 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Setup
  class MappingConverter < ConverterTransformation
    include WithSourceOptions
    include Setup::TranslationCommon::ClassMethods

Severity: Minor
Found in app/models/setup/mapping_converter.rb - About 7 hrs to fix

    Method do_map has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_map(source)
          plain_properties = []
          map_model.properties_schemas.each do |property, schema|
            plain_properties << property unless schema[MappingModel::SCHEMA_FLAG]
          end
    Severity: Minor
    Found in app/models/setup/mapping_converter.rb - About 6 hrs 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 to_map_schema has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_map_schema(sch)
            if sch['type'] == 'object' && (properties = sch['properties']).is_a?(Hash)
              new_properties = {}
              id_optional = true
              properties.each do |property, property_schema|
    Severity: Minor
    Found in app/models/setup/mapping_converter.rb - About 4 hrs 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_schema has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def mapping_schema(target_data_type_id = nil)
            sch = {
              SCHEMA_FLAG.to_s => true,
              type: 'object',
              properties: {
    Severity: Major
    Found in app/models/setup/mapping_converter.rb - About 2 hrs to fix

      Method validates_mapping has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def validates_mapping
            mapping.validate
            unless mapping.errors.present?
              map_model.for_each_association do |a|
                name = a[:name]
      Severity: Major
      Found in app/models/setup/mapping_converter.rb - About 2 hrs to fix

        Method mapping_schema has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def mapping_schema(target_data_type_id = nil)
                sch = {
                  SCHEMA_FLAG.to_s => true,
                  type: 'object',
                  properties: {
        Severity: Minor
        Found in app/models/setup/mapping_converter.rb - About 2 hrs 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 do_map has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def do_map(source)
              plain_properties = []
              map_model.properties_schemas.each do |property, schema|
                plain_properties << property unless schema[MappingModel::SCHEMA_FLAG]
              end
        Severity: Minor
        Found in app/models/setup/mapping_converter.rb - About 1 hr to fix

          Method to_map_schema has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def to_map_schema(sch)
                  if sch['type'] == 'object' && (properties = sch['properties']).is_a?(Hash)
                    new_properties = {}
                    id_optional = true
                    properties.each do |property, property_schema|
          Severity: Minor
          Found in app/models/setup/mapping_converter.rb - About 1 hr to fix

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

                def run_transformation(transformation, source_data_type, source, options)
                  source = [source] unless source.is_a?(Enumerable)
                  if (transformation.type == :Export && transformation.try(:bulk_source)) ||
                    (transformation.type == :Conversion && transformation.try(:source_handler)) #TODO After remove legacy translators check try(:bulk_source) and try(:source_handler)
                    r = transformation.run(source_data_type: source_data_type, objects: source, save_result: false, options: options)
            Severity: Minor
            Found in app/models/setup/mapping_converter.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 write_attribute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def write_attribute(name, value)
                  if name.to_s == 'map_attributes'
                    value.delete('_type')
                    value.delete(:_type)
                    value.each do |k, v|
            Severity: Minor
            Found in app/models/setup/mapping_converter.rb - About 1 hr to fix

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

                  def mapping=(data)
                    unless data.is_a?(Hash)
                      data =
                        if data.is_a?(String)
                          JSON.parse(data)
              Severity: Minor
              Found in app/models/setup/mapping_converter.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

              Avoid deeply nested control flow statements.
              Open

                              value.delete(k) if v.empty?
              Severity: Major
              Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                unless t_target_dt == sub_map_target_dt
                                  sub_map.errors.add(:transformation, "target data type (#{t_target_dt ? t_target_dt.custom_title : 'nil'}) is invalid (#{sub_map_target_dt.custom_title} expected)")
                                end
                Severity: Major
                Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    value.delete(k) unless v.is_a?(Array)
                  Severity: Major
                  Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                      value.delete(k) unless v.is_a?(Hash)
                    Severity: Major
                    Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        value.delete(k) unless v.is_a?(String)
                      Severity: Major
                      Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

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

                            def map_model
                              if source_data_type && target_data_type
                                if @mongoff_model && @mongoff_model.data_type != target_data_type
                                  @mongoff_model = nil
                                end
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                  unless target_model.nil? || (target_model.is_a?(Class) && result.is_a?(target_association.klass)) ||
                                    (result.is_a?(Mongoff::Record) && result.is_a?(target_model))
                                    opts = opts.merge(discard_events: true).with_indifferent_access
                                    if transformation.type == :Export && target_model.data_type.is_a?(Setup::FileDataType)
                                      opts[:contentType] ||= transformation.mime_type
                        Severity: Major
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 2 hrs to fix
                        app/models/setup/converter.rb on lines 105..115

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    if (t_data_type = transformation.data_type).nil? || t_data_type == source_dt
                                      unless transformation.type == :Export
                                        sub_map_target_dt = target_data_type.records_model.property_model(name).data_type
                                        t_target_dt = transformation.target_data_type
                                        unless t_target_dt == sub_map_target_dt
                        Severity: Major
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 1 hr to fix
                        app/models/setup/converter.rb on lines 235..245

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                              def file_mapping_schema
                                field_schema = { type: 'string' }
                                if (source = auto_complete_source).present?
                                  field_schema['format'] = 'auto-complete'
                                  field_schema['source'] = source
                        Severity: Major
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 1 hr to fix
                        app/models/setup/converter.rb on lines 396..412

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            def map_model
                              if source_data_type && target_data_type
                                if @mongoff_model && @mongoff_model.data_type != target_data_type
                                  @mongoff_model = nil
                                end
                        Severity: Major
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 1 hr to fix
                        app/models/setup/converter.rb on lines 258..272

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                    unless property_dt == source_data_type
                                      enum << property
                                      title = property_dt.schema['title'] || property.to_title
                                      if titles.include?(title)
                                        title = "#{title} (#{property.to_title})"
                        Severity: Major
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 1 hr to fix
                        app/models/setup/converter.rb on lines 381..389

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            def render_template(template, data_type, record)
                              locals = {}
                              data_type.records_model.properties.each do |property|
                                locals[property] = record.send(property)
                              end
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 45 mins to fix
                        app/models/setup/converter.rb on lines 142..156

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                              def auto_complete_source
                                if @parent_map_model
                                  @parent_map_model.auto_complete_source
                                else
                                  @auto_complete_source ||= source_data_type.records_model.properties_schemas.collect do |property, property_schema|
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 35 mins to fix
                        app/models/setup/converter.rb on lines 423..433

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                source.each do |obj|
                                  template = Liquid::Template.parse(options.to_json)
                                  opts = render_template(template, source_data_type, obj)
                                  r = transformation.run(source_data_type: source_data_type, object: obj, save_result: false, options: opts)
                                  yield r, opts if block_given?
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 30 mins to fix
                        app/models/setup/converter.rb on lines 133..138

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                      filter: {
                                        '$and': [
                                          { '$or': [
                                            { source_data_type: { a: { v: '_blank' } } },
                                            { source_data_type: { b: { v: '__source_data_type_id__' } } }
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 25 mins to fix
                        app/models/setup/converter.rb on lines 347..357

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

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                  if transformation
                                    t_types = [:Export]
                                    t_types << :Conversion unless target_data_type.is_a?(Setup::FileDataType)
                                    sub_map.errors.add(:transformation, 'type is invalid') unless t_types.include?(transformation.type)
                                  else
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 25 mins to fix
                        app/models/setup/converter.rb on lines 221..226

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                      description = data_type.merge_schema(property_schema)['description']
                                      description = "#{description}<br><strong>Define a transformation from #{source_data_type.custom_title} to #{property_dt.custom_title}</strong>"
                                      property_schema = mapping_schema(property_dt.id.to_s).merge!('description' => description)
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 25 mins to fix
                        app/models/setup/converter.rb on lines 443..445

                        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

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                if target_data_type_id
                                  types << Setup::Converter.to_s
                                  type_conditions << { '$and': [{ type: { d: { v: 'Conversion' } } }, { target_data_type: { e: { v: target_data_type_id } } }] }
                        Severity: Minor
                        Found in app/models/setup/mapping_converter.rb and 1 other location - About 20 mins to fix
                        app/models/setup/converter.rb on lines 368..370

                        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

                        There are no issues that match your filters.

                        Category
                        Status