riboseinc/ruby-vobject

View on GitHub

Showing 79 of 214 total issues

Method vobject_grammar has a Cognitive Complexity of 202 (exceeds 5 allowed). Consider refactoring.
Open

    def vobject_grammar
      # properties with value cardinality 1
      @cardinality1 = {}
      @cardinality1[:ICAL] = Set.new [:PRODID, :VERSION, :CALSCALE, :METHOD, :UID, :LAST_MOD, :URL,
                                      :REFRESH_INTERVAL, :SOURCE, :COLOR]
Severity: Minor
Found in lib/vobject/vcalendar/grammar.rb - About 4 days 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 paramcheck has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
Open

      def paramcheck(strict, prop, params, ctx)
        errors = []
        if params && params[:ALTREP]
          case prop
          when :COMMENT, :DESCRIPTION, :LOCATION, :RESOURCES, :SUMMARY,
Severity: Minor
Found in lib/vobject/vcalendar/paramcheck.rb - About 2 days 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 paramcheck has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

      def paramcheck(strict, prop, params, ctx)
        errors = []
        if params && params[:TYPE]
          parse_err(strict, errors, "multiple values for :TYPE parameter of #{prop}", ctx) if params[:TYPE].is_a?(Array) && params[:TYPE].length > 1 && prop != :EMAIL && prop != :ADR && prop != :TEL && prop != :LABEL && prop != :IMPP
        end
Severity: Minor
Found in lib/vobject/vcard/v3_0/paramcheck.rb - About 2 days 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 vobject_grammar has 414 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def vobject_grammar
      # properties with value cardinality 1
      @cardinality1 = {}
      @cardinality1[:ICAL] = Set.new [:PRODID, :VERSION, :CALSCALE, :METHOD, :UID, :LAST_MOD, :URL,
                                      :REFRESH_INTERVAL, :SOURCE, :COLOR]
Severity: Major
Found in lib/vobject/vcalendar/grammar.rb - About 2 days to fix

    Method paramcheck has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

          def paramcheck(strict, prop, params, ctx)
            errors = []
            if params && params[:TYPE]
              case prop
              when :FN, :NICKNAME, :PHOTO, :ADR, :TEL, :EMAIL, :IMPP, :LANG, :TZ,
    Severity: Minor
    Found in lib/vobject/vcard/v4_0/paramcheck.rb - About 2 days 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 typematch has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

          def typematch(strict, key, params, component, value, ctx)
            errors = []
            errors << property_parent(strict, key, component, value, ctx)
            ctx1 = Rsec::ParseContext.new value, "source"
            case key
    Severity: Minor
    Found in lib/vobject/vcalendar/typegrammars.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 timezoneadjust has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

        def timezoneadjust(x)
          if x[:TZID].nil? || x[:TZID].empty?
            return x
          end
          # TODO deal with unregistered timezones
    Severity: Minor
    Found in lib/vobject/vcalendar/grammar.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 paramcheck has 231 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def paramcheck(strict, prop, params, ctx)
            errors = []
            if params && params[:ALTREP]
              case prop
              when :COMMENT, :DESCRIPTION, :LOCATION, :RESOURCES, :SUMMARY,
    Severity: Major
    Found in lib/vobject/vcalendar/paramcheck.rb - About 1 day to fix

      File typegrammars.rb has 548 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "rsec"
      require "set"
      require "uri"
      require "date"
      require "tzinfo"
      Severity: Major
      Found in lib/vobject/vcalendar/typegrammars.rb - About 1 day to fix

        File grammar.rb has 546 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "rsec"
        require "set"
        require "uri"
        require "date"
        require "tzinfo"
        Severity: Major
        Found in lib/vobject/vcalendar/grammar.rb - About 1 day to fix

          Method typematch has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

                def typematch(strict, key, params, _component, value)
                  errors = []
                  ctx1 = Rsec::ParseContext.new value, "source"
                  case key
                  when :VERSION
          Severity: Minor
          Found in lib/vobject/vcard/v4_0/typegrammars.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 address has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

                def address
                  text = C::TEXT3
                  component = seq(text << ",".r, lazy { component }) do |(a, b)|
                    [unescape(a), b].flatten
                  end | text.map { |t| [unescape(t)] }
          Severity: Minor
          Found in lib/vobject/vcard/v3_0/typegrammars.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 paramcheck has 212 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def paramcheck(strict, prop, params, ctx)
                  errors = []
                  if params && params[:TYPE]
                    case prop
                    when :FN, :NICKNAME, :PHOTO, :ADR, :TEL, :EMAIL, :IMPP, :LANG, :TZ,
          Severity: Major
          Found in lib/vobject/vcard/v4_0/paramcheck.rb - About 1 day to fix

            File propertyvalue.rb has 505 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "vobject"
            require "vobject/propertyvalue"
            
            module Vobject
              module Vcalendar
            Severity: Major
            Found in lib/vobject/vcalendar/propertyvalue.rb - About 1 day to fix

              Method typematch has 193 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def typematch(strict, key, params, component, value, ctx)
                      errors = []
                      errors << property_parent(strict, key, component, value, ctx)
                      ctx1 = Rsec::ParseContext.new value, "source"
                      case key
              Severity: Major
              Found in lib/vobject/vcalendar/typegrammars.rb - About 7 hrs to fix

                File typegrammars.rb has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require "rsec"
                require "set"
                require "uri"
                require "date"
                include Rsec::Helpers
                Severity: Minor
                Found in lib/vobject/vcard/v4_0/typegrammars.rb - About 7 hrs to fix

                  Method vobject_grammar has 148 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def vobject_grammar
                        # properties with value cardinality 1
                        @cardinality1 = {}
                        @cardinality1[:PARAM] = Set.new [:VALUE]
                        @cardinality1[:PROP] = Set.new [:KIND, :N, :BDAY, :ANNIVERSARY, :GENDER, :PRODID, :REV, :UID, :BIRTHPLACE, :DEATHPLACE, :DEATHDATE]
                  Severity: Major
                  Found in lib/vobject/vcard/v4_0/grammar.rb - About 5 hrs to fix

                    File typegrammars.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require "rsec"
                    require "set"
                    require "uri"
                    require "date"
                    include Rsec::Helpers
                    Severity: Minor
                    Found in lib/vobject/vcard/v3_0/typegrammars.rb - About 5 hrs to fix

                      Class Typegrammars has 39 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Typegrammars
                          class << self
                            # property value types, each defining their own parser
                            def recur
                              freq = /SECONDLY/i.r | /MINUTELY/i.r | /HOURLY/i.r | /DAILY/i.r |
                      Severity: Minor
                      Found in lib/vobject/vcalendar/typegrammars.rb - About 5 hrs to fix

                        Method vobject_grammar has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def vobject_grammar
                              # properties with value cardinality 1
                              @cardinality1 = {}
                              @cardinality1[:PARAM] = Set.new [:VALUE]
                              @cardinality1[:PROP] = Set.new [:KIND, :N, :BDAY, :ANNIVERSARY, :GENDER, :PRODID, :REV, :UID]
                        Severity: Minor
                        Found in lib/vobject/vcard/v3_0/grammar.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