linyows/stalkerr

View on GitHub

Showing 10 of 10 total issues

Method parse has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(event)
      obj = event.payload
      repository = event.repo.name

      status = title = link = ''
Severity: Minor
Found in lib/stalkerr/target/github.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 parse has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse(event)
      obj = event.payload
      repository = event.repo.name

      status = title = link = ''
Severity: Major
Found in lib/stalkerr/target/github.rb - About 5 hrs to fix

    Method stalking has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def stalking(&post)
          return if @last_fetched_at && Time.now.utc < @last_fetched_at + INTERVAL
          @last_fetched_at = Time.now.utc
    
          @post = post
    Severity: Minor
    Found in lib/stalkerr/target/qiita.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 posts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def posts(p)
          header = ''
          header = "(#{p[:repository]}) #{p[:status]}" unless p[:repository].eql? ''
          header = "#{header} #{p[:title]}" unless p[:title].eql? ''
          header = "#{header} - #{shorten(p[:link]).to_irc_color.blue}" unless p[:link].eql? ''
    Severity: Minor
    Found in lib/stalkerr/target/github.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 parse has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse(type, data)
          nick, obj = data
          header = status = title = link = ''
          body = []
          notice_body = false
    Severity: Minor
    Found in lib/stalkerr/target/qiita.rb - About 1 hr to fix

      Method parse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse(type, data)
            nick, obj = data
            header = status = title = link = ''
            body = []
            notice_body = false
      Severity: Minor
      Found in lib/stalkerr/target/qiita.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 stalking has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def stalking(&post)
            return if @last_fetched_at && Time.now.utc < @last_fetched_at + INTERVAL
            @last_fetched_at = Time.now.utc
      
            @post = post
      Severity: Minor
      Found in lib/stalkerr/target/qiita.rb - About 1 hr to fix

        Method stalking has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def stalking(&post)
              @post = post
              client.received_events(@username).sort_by(&:id).reverse_each { |event|
                if @last_event_id.nil?
                  time = Time.now - Stalkerr::Const::ROLLBACK_SEC
        Severity: Minor
        Found in lib/stalkerr/target/github.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 parse! has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.parse!(argv)
            opts = {
              host: Stalkerr::Const::DEFAULT_HOST,
              port: Stalkerr::Const::DEFAULT_PORT,
              log: nil,
        Severity: Minor
        Found in lib/stalkerr/optparse.rb - About 1 hr to fix

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

              def guard(params)
                ch = params[:channel]
                return if @threads[ch].is_a?(Thread) && @threads[ch].alive?
                post @nick, JOIN, ch
          
          
          Severity: Minor
          Found in lib/stalkerr/session.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

          Severity
          Category
          Status
          Source
          Language