openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

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

  class TransformingObjectException < Exception

    attr_reader :object

    def initialize(object)
Severity: Minor
Found in app/models/setup/legacy_translator.rb and 1 other location - About 40 mins to fix
app/models/setup/target_handler_transformation.rb on lines 15..27

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

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 (sub_model = json['_type']) &&
          sub_model.is_a?(String) &&
          (sub_model = sub_model.start_with?('self[') ? (json.send(:eval, sub_model) rescue nil) : sub_model) &&
          (data_type = data_type.find_data_type(sub_model)) &&
          (sub_model = data_type.records_model) &&
Severity: Minor
Found in lib/edi/parser.rb and 1 other location - About 40 mins to fix
lib/edi/parser.rb on lines 379..387

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

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

    class PersistenceException < Exception

      attr_reader :record

      def initialize(record)
Severity: Minor
Found in app/models/setup/target_handler_transformation.rb and 1 other location - About 40 mins to fix
app/models/setup/legacy_translator.rb on lines 323..335

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

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 (sub_model = json['_type']) &&
            sub_model.is_a?(String) &&
            (sub_model = sub_model.start_with?('self[') ? (json.send(:eval, sub_model) rescue nil) : sub_model) &&
            (data_type = data_type.find_data_type(sub_model)) &&
            (sub_model = data_type.records_model) &&
Severity: Minor
Found in lib/edi/parser.rb and 1 other location - About 40 mins to fix
lib/edi/parser.rb on lines 588..596

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

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

Method check_definitions has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def check_definitions(json, parent, defined_types, embedded_refs, root_schema)
Severity: Minor
Found in app/models/setup/json_data_type.rb - About 35 mins to fix

    Method process_connection has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def process_connection(template_parameters, verbose_response, last_response, options, &block)
    Severity: Minor
    Found in app/models/concerns/setup/webhook_common.rb - About 35 mins to fix

      Method check_schema has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def check_schema(json, name, defined_types, embedded_refs, root_schema)
      Severity: Minor
      Found in app/models/setup/json_data_type.rb - About 35 mins to fix

        Method parse_json has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def parse_json(data_type, content, options = {}, record = nil, model = nil)
        Severity: Minor
        Found in lib/edi/parser.rb - About 35 mins to fix

          Method check_patternProperties has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def check_patternProperties(patterns, instance, state, data_type, options)
          Severity: Minor
          Found in lib/mongoff/validator.rb - About 35 mins to fix

            Method check_additionalProperties has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def check_additionalProperties(schema, instance, state, data_type, options)
            Severity: Minor
            Found in lib/mongoff/validator.rb - About 35 mins to fix

              Method check_properties has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def check_properties(properties, instance, state, data_type, options)
              Severity: Minor
              Found in lib/mongoff/validator.rb - About 35 mins to fix

                Method check_items has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def check_items(items_schema, items, state, data_type, options)
                Severity: Minor
                Found in lib/mongoff/validator.rb - About 35 mins to fix

                  Method check_propertyNames has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def check_propertyNames(schema, instance, state, data_type, options)
                  Severity: Minor
                  Found in lib/mongoff/validator.rb - About 35 mins to fix

                    Method check_additionalItems has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def check_additionalItems(items_schema, items, state, data_type, options)
                    Severity: Minor
                    Found in lib/mongoff/validator.rb - About 35 mins to fix

                      Method record_to_edi has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def record_to_edi(data_type, options, schema, record, enclosed_property_name = nil)
                      Severity: Minor
                      Found in lib/edi/formater.rb - About 35 mins to fix

                        Method edi_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def edi_value(record, property_name, property_schema, property_model, options)
                        Severity: Minor
                        Found in lib/edi/formater.rb - About 35 mins to fix

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

                              def check_minProperties(min, instance)
                                if instance.is_a?(Mongoff::Record) || instance.is_a?(Hash)
                                  instance = instance.orm_model.stored_properties_on(instance) if instance.is_a?(Mongoff::Record)
                                  raise_path_less_error "has too few properties (#{instance.size} for #{min} min)" if instance.size < min
                                end
                          Severity: Minor
                          Found in lib/mongoff/validator.rb and 1 other location - About 35 mins to fix
                          lib/mongoff/validator.rb on lines 864..868

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

                          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 check_maxProperties(max, instance)
                                if instance.is_a?(Mongoff::Record) || instance.is_a?(Hash)
                                  instance = instance.orm_model.stored_properties_on(instance) if instance.is_a?(Mongoff::Record)
                                  raise_path_less_error "has too many properties (#{instance.size} of #{max} max)" if instance.size > max
                                end
                          Severity: Minor
                          Found in lib/mongoff/validator.rb and 1 other location - About 35 mins to fix
                          lib/mongoff/validator.rb on lines 876..880

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

                          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

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

                                def pulling(field, options)
                                  if @pulling_field
                                    fail "Pulling field already configured: #{@pulling_field}"
                                  else
                                    field = field.to_s.to_sym
                          Severity: Minor
                          Found in app/models/concerns/setup/pulling_field.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def process(record)
                                email_data_type = self.email_data_type || Setup::Configuration.singleton_record.email_data_type
                          
                                fail 'Email data type not configured' unless email_data_type
                          
                          
                          Severity: Minor
                          Found in app/models/setup/email_notification.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

                          Severity
                          Category
                          Status
                          Source
                          Language