openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method check_properties has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

    def check_properties(json_schema, options = {})
      object_schema =
        case json_schema['type']
        when 'object'
          json_schema
Severity: Minor
Found in app/models/setup/schema_handler.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

File parser.rb has 590 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Edi
  class Parser

    class << self

Severity: Major
Found in lib/edi/parser.rb - About 1 day to fix

    File webhook_common.rb has 587 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'net/ftp'
    
    module Setup
      module WebhookCommon
        extend ActiveSupport::Concern
    Severity: Major
    Found in app/models/concerns/setup/webhook_common.rb - About 1 day to fix

      Method save_request_data has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

          def save_request_data
            @data_types ||= {}
            @request_id = request.uuid
            @webhook_body = request.body.read
            @ns_slug = params[:ns]
      Severity: Minor
      Found in app/controllers/api/v2/api_controller.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 index has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
      Open

        def index
          if (tenant = Tenant.where(id: params[:tenant_id]).first)
            tenant.switch do
              model = nil
              if (model_desc = params[:model])
      Severity: Minor
      Found in app/controllers/file_controller.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 []= has a Cognitive Complexity of 57 (exceeds 5 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: Minor
      Found in lib/mongoff/record.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

      File flow.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'nokogiri'
      
      module Setup
        class Flow
          # = Flow
      Severity: Major
      Found in app/models/setup/flow.rb - About 1 day to fix

        Class Model has 61 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Model
            include Setup::InstanceModelParser
            include MetadataAccess
            include PrettyErrors
            include ThreadAware
        Severity: Major
        Found in lib/mongoff/model.rb - About 1 day to fix

          Method pull has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

                def pull(shared_collection, pull_request = {})
                  pull_request = pull_request.with_indifferent_access
                  pull_request = pull_request(shared_collection, pull_request) if pull_request[:pull_data].nil?
                  errors = []
                  if pull_request[:missing_parameters].blank?
          Severity: Minor
          Found in app/models/setup/base_pull.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 do_parse_json has 211 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def do_parse_json(data_type, model, json, options, json_schema, record = nil, new_record = nil, container = nil, container_schema = nil)
                  add_new = options.delete(:add_new)
                  updating = !(record.nil? && new_record.nil?) || options[:add_only]
                  (primary_fields = options.delete(:primary_field) || options.delete('primary_field')).present? ||
                    (primary_fields = json.is_a?(Hash) && json['_primary']).present? ||
          Severity: Major
          Found in lib/edi/parser.rb - About 1 day to fix

            Method enqueue has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

                  def enqueue(message, &block)
                    message = message.with_indifferent_access
                    task_description = message[:task_description]
                    auto_retry = message[:auto_retry].presence || Setup::Task.auto_retry_enum.first
                    scheduler = message.delete(:scheduler)
            Severity: Minor
            Found in lib/cenit/rabbit.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

            File model.rb has 514 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Mongoff
              class Model
                include Setup::InstanceModelParser
                include MetadataAccess
                include PrettyErrors
            Severity: Major
            Found in lib/mongoff/model.rb - About 1 day to fix

              Method validates_configuration has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validates_configuration
                    requires(:name)
                    errors.add(:type, 'is not valid') unless type_enum.include?(type)
                    errors.add(:style, 'is not valid') unless style_enum.include?(style)
                    case type
              Severity: Minor
              Found in app/models/setup/legacy_translator.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 submit has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
              Open

                  def submit(*args, &block)
                    if (options = args[0]).is_a?(Hash)
                      body_argument = options[:body]
                    else
                      body_argument = options
              Severity: Minor
              Found in app/models/concerns/setup/webhook_common.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 authorize_account has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
              Open

                def authorize_account(soft = false)
                  account_backup = Account.current
                  user_backup = User.current
                  Account.current = User.current = error_description = nil
                  if (auth_header = request.headers['Authorization'])
              Severity: Minor
              Found in app/controllers/Oauth2AccountAuthorization.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

              Method record_to_edi has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                  def record_to_edi(data_type, options, schema, record, enclosed_property_name = nil)
                    output = []
                    return output unless record
                    field_sep = options[:field_separator]
                    segment =
              Severity: Minor
              Found in lib/edi/formater.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

              Class BuildInDataType has 54 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class BuildInDataType
                  include SchemaHandler
                  include DataTypeParser
              
                  attr_reader :model
              Severity: Major
              Found in app/models/setup/build_in_data_type.rb - About 7 hrs to fix

                Method initialize has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(scope = '')
                      @openid = Set.new
                      @access = {}
                      @super_methods = Set.new
                      scope = scope.to_s.strip
                Severity: Minor
                Found in app/models/cenit/oauth_scope.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

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

                (function () {
                    Array.from(
                        document.getElementsByClassName('responsive-box')
                    ).forEach(
                        rbox => Array.from(rbox.getElementsByClassName('devise box')).forEach(
                Severity: Major
                Found in app/assets/javascript/devise.js and 1 other location - About 7 hrs to fix
                public/assets/devise-a3ac59f99950234f6b585f77da727a612629225f4e17d2f4293d3884c16dd261.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 186.

                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

                Severity
                Category
                Status
                Source
                Language