openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method bind_references has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def bind_references(record, options = {})
        options ||= {}
        references = {}
        for_each_node_starting_at(record, options) do |obj|
          ::Setup::Optimizer.instance.regist_data_types(obj)
Severity: Major
Found in lib/cenit/utility.rb - About 3 hrs to fix

    Class ApiController has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class ApiController < ApplicationController
    
        include OAuth2AccountAuthorization
        include CorsCheck
    
    
    Severity: Minor
    Found in app/controllers/api/v3/api_controller.rb - About 3 hrs to fix

      Method []= has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def []=(field, value)
            field = field.to_sym
            @changed = true
            @validated = false
            field = :_id if %w(id _id).include?(field.to_s)
      Severity: Major
      Found in lib/mongoff/record.rb - About 3 hrs to fix

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

            def run(message)
              if (flow = agent_from_msg)
                if flow.active
                  unless (execution_graph = message[:execution_graph])
                    execution_graph = message[:execution_graph] = {}
        Severity: Minor
        Found in app/models/setup/flow_execution.rb - About 3 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 lazada_rest_api_refresh_token has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def lazada_rest_api_refresh_token(authorization)
              if is_time_to_refresh?(authorization, Cenit.delay_time_for_lazada_token_refresh)
                client = authorization.client
                fail 'Missing client configuration' unless client
                fail 'Missing OAuth provider configuration' unless authorization.provider
        Severity: Minor
        Found in app/models/setup/base_oauth_provider.rb - About 3 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 has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def new
              response =
                {
                  success: success_report = {},
                  errors: broken_report = {}
        Severity: Minor
        Found in app/controllers/api/v1/api_controller.rb - About 3 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 unique_properties has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def unique_properties
              unless @unique_properties
                @unique_properties = []
                properties.each do |property|
                  sch = property_schema(property)
        Severity: Minor
        Found in lib/mongoff/metadata_access.rb - About 3 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

        Class LegacyTranslator has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class LegacyTranslator < Translator
            include ReqRejValidator
            include SnippetCode
            # = Translator
            #
        Severity: Minor
        Found in app/models/setup/legacy_translator.rb - About 3 hrs to fix

          Class Flow has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Flow
              # = Flow
              #
              # Defines how data is processed by the execution of one or more actions.
          
          
          Severity: Minor
          Found in app/models/setup/flow.rb - About 3 hrs to fix

            Method optimize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def optimize
                  data_types = @nss.values.collect { |ns_hash| ns_hash.values.to_a }.flatten
                  while (data_type = data_types.shift)
                    segments = {}
                    refs = Set.new
            Severity: Minor
            Found in app/models/setup/optimizer.rb - About 3 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 23 (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/converter.rb - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def to_json_schema
                  json = documenting('type' => 'object', 'title' => tag_name.to_title)
                  json['properties'] = properties = {}
                  required = []
                  if max_occurs == :unbounded || max_occurs.positive? || min_occurs > 1
            Severity: Minor
            Found in lib/xsd/container.rb - About 3 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 scheduler.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Setup
              class Scheduler < Event
                include HashField
                include Switchable
                # = Scheduler
            Severity: Minor
            Found in app/models/setup/scheduler.rb - About 3 hrs to fix

              Class DataType has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class DataType
                  include SharedConfigurable
                  include NamespaceNamed
                  include SchemaHandler
                  include DataTypeParser
              Severity: Minor
              Found in app/models/setup/data_type.rb - About 3 hrs to fix

                Class JsonDataType has 27 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class JsonDataType < DataType
                    include Setup::SnippetCode
                
                    origins Setup::CrossOriginShared::DEFAULT_ORIGINS
                
                
                Severity: Minor
                Found in app/models/setup/json_data_type.rb - About 3 hrs to fix

                  Method validates_configuration has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def validates_configuration
                        format_triggers_on(:scope_filter) if scope_filter.present?
                        unless requires(:name, :translator)
                          if event.present?
                            unless translator.type == :Import || requires(:data_type_scope)
                  Severity: Major
                  Found in app/models/setup/flow.rb - About 3 hrs to fix

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

                        def run(message)
                          if (source_collection = Setup::Collection.where(id: (source_collection_id = message[:source_collection_id])).first)
                            if (shared_collection = Setup::CrossSharedCollection.where(id: (shared_collection_id = message[:shared_collection_id])).first)
                              begin
                                if shared_collection.installed?
                    Severity: Minor
                    Found in app/models/setup/push.rb - About 3 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 run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def run(message)
                          message = message.with_indifferent_access
                          json_schemas = Setup::DataTypeGeneration.data_type_schemas(message[:source], { data_type_names: data_type_names = {} })
                          json_schemas.each do |ns, data_type_schemas|
                            existing_data_types = Setup::DataType.any_in(namespace: ns, name: data_type_schemas.keys)
                    Severity: Minor
                    Found in app/models/setup/data_type_generation.rb - About 3 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 post_digest_token has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def post_digest_token(request, _options = {})
                          error_field = '$'
                          body = request.body.read
                          payload =
                            if body.blank?
                    Severity: Minor
                    Found in app/controllers/api/v3/api_controller.rb - About 3 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 post_digest_schedule has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def post_digest_schedule(request, _options = {})
                          sch_data = request.body.read.strip
                          sch_data = sch_data.empty? ? {} : JSON.parse(sch_data)
                          scheduler =
                            if sch_data.empty?
                    Severity: Minor
                    Found in app/controllers/api/v3/api_controller.rb - About 3 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