openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method pull_request has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def pull_request(shared_collection, options = {})
        pull_parameters = options[:pull_parameters] || {}
        missing_parameters = []
        unless options[:ignore_missing_parameters]
          shared_collection.each_pull_parameter do |pull_parameter|
Severity: Major
Found in app/models/setup/base_pull.rb - About 5 hrs to fix

    Class Record has 40 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Record
        include Savable
        include Destroyable
        include Edi::Filler
        include Edi::Formatter
    Severity: Minor
    Found in lib/mongoff/record.rb - About 5 hrs to fix

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

          def run(message)
            data_type = data_type_from(message)
            if data_type
              if data_type.bulkable_deletable?
                if (model = data_type.records_model)
      Severity: Minor
      Found in app/models/setup/deletion.rb - About 5 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 check_schema has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_schema(json, name, defined_types, embedded_refs, root_schema)
            if (refs = json['$ref'])
              refs = [refs] unless refs.is_a?(Array)
              refs.each { |ref| embedded_refs[ref] = check_embedded_ref(ref, root_schema) if ref.is_a?(String) && ref.start_with?('#') }
            elsif json['type'].nil? || json['type'].eql?('object')
      Severity: Minor
      Found in app/models/setup/json_data_type.rb - About 5 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 check_type has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_type(types, instance, _, _, options, schema)
            return if instance.nil? && options[:skip_nulls]
            if types
              types = [types] unless types.is_a?(Array)
              types = types.map(&:to_s).map(&:to_sym)
      Severity: Minor
      Found in lib/mongoff/validator.rb - About 5 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 check_dependentRequired has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_dependentRequired(properties, instance)
            return unless instance
            if instance.is_a?(Mongoff::Record)
              has_errors = false
              stored_properties = instance.orm_model.stored_properties_on(instance).map(&:to_s)
      Severity: Minor
      Found in lib/mongoff/validator.rb - About 5 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 check_additionalProperties has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_additionalProperties(schema, instance, state, data_type, options)
            path = options[:path] || '#'
            unless (checked_properties = state[:checked_properties])
              checked_properties = state[:checked_properties] = Set.new
            end
      Severity: Minor
      Found in lib/mongoff/validator.rb - About 5 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 check_properties has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_properties(properties, instance, state, data_type, options)
            path = options[:path] || '#'
            unless (checked_properties = state[:checked_properties])
              checked_properties = state[:checked_properties] = Set.new
            end
      Severity: Minor
      Found in lib/mongoff/validator.rb - About 5 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 new_user has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def new_user
            data = (JSON.parse(request_data) rescue {}).keep_if { |key, _| USER_API_FIELDS.include?(key) }
            data = data.with_indifferent_access
            data.reverse_merge!(email: params[:email], password: pwd = params[:password])
            data.reject! { |_, value| value.nil? }
      Severity: Minor
      Found in app/controllers/api/v3/api_controller.rb - About 5 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_json_schema has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_json_schema
            json_schema = documenting('type' => 'object')
            if name
              json_schema['title'] = name.to_title
            end
      Severity: Minor
      Found in lib/xsd/complex_type.rb - About 5 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 cross_shared_collection.rb has 373 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Setup
        class CrossSharedCollection
          include CenitUnscoped
          include CrossOrigin::CenitDocument
          include CollectionBehavior
      Severity: Minor
      Found in app/models/setup/cross_shared_collection.rb - About 4 hrs to fix

        Method index has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

          def index
            skip_consent = false
            if request.get?
              if @errors.blank?
                if @app_id && (@app_id.tenant == Account.current || @app_id.registered?)
        Severity: Minor
        Found in app/controllers/oauth_controller.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

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

        window.App = (function () {
            const resizeListeners = [];
        
            const resize = document.body.onresize = function () {
                resizeListeners.forEach(listener => {
        Severity: Major
        Found in app/assets/javascript/application.js and 1 other location - About 4 hrs to fix
        public/assets/application-cca9faa44ee4499d84af3bc198f282fee9826d357b6899ab6148d448ac5f2dfe.js on lines 1..19

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

        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

        window.App = (function () {
            const resizeListeners = [];
        
            const resize = document.body.onresize = function () {
                resizeListeners.forEach(listener => {
        app/assets/javascript/application.js on lines 1..19

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

        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 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 index has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def index
              setup_viewport
              items = select_items
              if (distinct = params[:format]&.match(/\Adistinct\((.+)\)\Z/))
                json = klass.collection.distinct(distinct[1], items.selector)
        Severity: Minor
        Found in app/controllers/api/v3/api_controller.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

        File build_in_data_type.rb has 364 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'edi/formater'
        require 'xsd/core_ext'
        
        module Setup
          class BuildInDataType
        Severity: Minor
        Found in app/models/setup/build_in_data_type.rb - About 4 hrs to fix

          Method simple_translate has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              def simple_translate(message, &block)
                unless (options = message[:options]).is_a?(Hash)
                  options = {}
                end
                task = message[:task]
          Severity: Minor
          Found in app/models/setup/flow.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 token has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            def token
              response = {}
              response_code = :bad_request
              errors = ''
              token_class =
          Severity: Minor
          Found in app/controllers/oauth_controller.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 property_for has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              def property_for(name)
                @properties_by_name ||= {}
                unless @properties_by_name.key?(name)
                  segment_property = nil
                  name_property = nil
          Severity: Minor
          Found in lib/mongoff/metadata_access.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

          Severity
          Category
          Status
          Source
          Language