riboseinc/ruby-vobject

View on GitHub

Showing 79 of 214 total issues

Method address has 59 lines of code (exceeds 25 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: Major
Found in lib/vobject/vcard/v3_0/typegrammars.rb - About 2 hrs to fix

    File paramcheck.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "rsec"
    require "set"
    require "uri"
    require "date"
    require "tzinfo"
    Severity: Minor
    Found in lib/vobject/vcalendar/paramcheck.rb - About 2 hrs to fix

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

        def initialize(key, cs, err)
          self.comp_name = key
          raise_invalid_initialization if key != name
          self.children = []
          if cs.nil?
      Severity: Minor
      Found in lib/vobject/component.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 valencode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def valencode(k, v)
                case k
                when :bysetpos, :byyearday
                  v.map do |x|
                    ret = x[:ordyrday]
      Severity: Minor
      Found in lib/vobject/vcalendar/propertyvalue.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 child_class has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def child_class(key, val)
            base_class = if key == :VTODO
                           Vobject::Component::Vcalendar::ToDo
                         elsif key == :VFREEBUSY
                           Vobject::Component::Vcalendar::FreeBusy
      Severity: Minor
      Found in lib/vobject/vcalendar/component.rb - About 1 hr 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 recur has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def recur
              freq = /SECONDLY/i.r | /MINUTELY/i.r | /HOURLY/i.r | /DAILY/i.r |
                /WEEKLY/i.r | /MONTHLY/i.r | /YEARLY/i.r
              enddate = C::DATE_TIME | C::DATE
              seconds = /[0-9]{1,2}/.r
      Severity: Minor
      Found in lib/vobject/vcalendar/typegrammars.rb - About 1 hr 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 child_class has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def child_class(key, val)
          base_class = if key == :VTODO
                         Vobject::Component::Vcalendar::ToDo
                       elsif key == :VFREEBUSY
                         Vobject::Component::Vcalendar::FreeBusy
      Severity: Minor
      Found in lib/vcalendar.rb - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def address
              component = seq(C::COMPONENT4 << ",".r, lazy { component }) do |(a, b)|
                [unescape_component(a), b].flatten
              end | C::COMPONENT4.map { |t| [unescape_component(t)] }
              address = seq(component << ";".r, component << ";".r,
      Severity: Minor
      Found in lib/vobject/vcard/v4_0/typegrammars.rb - About 1 hr 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_s has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def to_s
              ret = ""
              ret << if value[:year]
                       value[:year]
                     else
      Severity: Minor
      Found in lib/vobject/vcard/v4_0/propertyvalue.rb - About 1 hr 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 initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(key, options)
          if options.class == Array
            self.multiple = []
            options.each do |v|
              multiple << property_base_class.new(key, v)
      Severity: Minor
      Found in lib/vobject/property.rb - About 1 hr 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 valencode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def valencode(k, v)
                case k
                when :bysetpos, :byyearday
                  v.map do |x|
                    ret = x[:ordyrday]
      Severity: Minor
      Found in lib/vobject/vcalendar/propertyvalue.rb - About 1 hr to fix

        Method fivepartname has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def fivepartname
                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 hr to fix

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

                def initialize(val)
                  self.value = val.clone
                  # val consists of :time && :zone values. If :zone is empty, floating local time (i.e. system local time) is assumed
                  self.type = "datetimelocal"
                  val[:sec] += (val[:secfrac].to_f / (10**val[:secfrac].length)) if !val[:secfrac].nil? && !val[:secfrac].empty?
          Severity: Minor
          Found in lib/vobject/vcard/v3_0/propertyvalue.rb - About 1 hr 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 date_time has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def date_time
                  hour = /[0-9]{2}/.r
                  minute = /[0-9]{2}/.r
                  second = /[0-9]{2}/.r
                  time_notrunc = seq(hour, minute, second, C::ZONE._?) do |(h, m, s, z)|
          Severity: Minor
          Found in lib/vobject/vcard/v4_0/typegrammars.rb - About 1 hr to fix

            Method child_class has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def child_class(key, val)
                base_class = if key == :VTODO
                               Vobject::Component::Vcalendar::ToDo
                             elsif key == :VFREEBUSY
                               Vobject::Component::Vcalendar::FreeBusy
            Severity: Minor
            Found in lib/vcalendar.rb - About 1 hr to fix

              Method child_class has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def child_class(key, val)
                    base_class = if key == :VTODO
                                   Vobject::Component::Vcalendar::ToDo
                                 elsif key == :VFREEBUSY
                                   Vobject::Component::Vcalendar::FreeBusy
              Severity: Minor
              Found in lib/vobject/vcalendar/component.rb - About 1 hr to fix

                Method fivepartname has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def fivepartname
                        component = seq(C::COMPONENT4 << ",".r, lazy { component }) do |(a, b)|
                          [unescape_component(a), b].flatten
                        end | C::COMPONENT4.map { |t| [unescape_component(t)] }
                        fivepartname = seq(component << ";".r, component << ";".r,
                Severity: Minor
                Found in lib/vobject/vcard/v4_0/typegrammars.rb - About 1 hr 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 date_time has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def date_time
                        utc_offset = seq(C::SIGN, /[0-9]{2}/.r << /:/.r._?, /[0-9]{2}/.r) do |(s, h, m)|
                          { sign: s, hour: h, min: m }
                        end
                        zone = utc_offset.map { |u| u } |
                Severity: Minor
                Found in lib/vobject/vcard/v3_0/typegrammars.rb - About 1 hr to fix

                  Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def initialize(key, options)
                      if options.class == Array
                        self.multiple = []
                        options.each do |v|
                          multiple << property_base_class.new(key, v)
                  Severity: Minor
                  Found in lib/vobject/property.rb - About 1 hr to fix

                    Method to_s has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def to_s
                            ret = ""
                            ret << if value[:year]
                                     value[:year]
                                   else
                    Severity: Minor
                    Found in lib/vobject/vcard/v4_0/propertyvalue.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language