Showing 6 of 6 total issues

Method process_persistence has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        def process_persistence
          persisted = true
          begin
            persisted_file_content  = load_from_file(where_to_persist)
            r_objects       =  ActiveSupport::JSON.decode(persisted_file_content)
Severity: Minor
Found in lib/jason/encoding/persistable.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 has_many has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def has_many(*args)
        relation_name = args.shift.to_s
        options = args.empty? ? {} : args.shift
      
        class_name = options.fetch(:class, relation_name.downcase.singularize).capitalize
Severity: Minor
Found in lib/jason/relation.rb - About 1 hr to fix

    Method process_persistence has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def process_persistence
              persisted = true
              begin
                persisted_file_content  = load_from_file(where_to_persist)
                r_objects       =  ActiveSupport::JSON.decode(persisted_file_content)
    Severity: Minor
    Found in lib/jason/encoding/persistable.rb - About 1 hr to fix

      Method belongs_to has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def belongs_to(*args)
              relation_name = args.shift.to_s
              options       = args.empty? ? {} : args.shift
      
              class_name    = options.fetch(:class, relation_name).capitalize
      Severity: Minor
      Found in lib/jason/relation.rb - About 1 hr to fix

        Method process_has_many has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def process_has_many(reflection,value)
                  persist = instance_method(:run_relation_persistence)
                  action = lambda do |relation_name,relation_class,value|
                    ids = value.split(Jason::has_many_separator)
                    ids.each do |id|
        Severity: Minor
        Found in lib/jason/encoding/persistable.rb - About 45 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 attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def attribute(*args)
                attribute_name,attribute_type = args[0], args[1]
        
                unless DATA_TYPES.keys.include?("#{attribute_type}".to_sym)
                  raise Errors::NotSupportedDataTypeError.new("This Kind of type is not supported or missing!") 
        Severity: Minor
        Found in lib/jason/persistence.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

        Severity
        Category
        Status
        Source
        Language