Showing 15 of 15 total issues

Class TrelloMessage has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

    class TrelloMessage

      attr_reader :notfound

      def initialize(action)
Severity: Minor
Found in plugins/trellolistener.rb - About 4 hrs to fix

    File trellolistener.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "cgi"
    
    
    module Cinch
      module Plugins
    Severity: Minor
    Found in plugins/trellolistener.rb - About 3 hrs to fix

      Method fetch_rss has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

            def fetch_rss
              @bot.debug 'Fetching rss'
              @feeds ||= {}
              @bot.config.options['cogconf']['rss']['channels'].each do |chan|
                prefix = chan['prefix']
      Severity: Minor
      Found in plugins/rss.rb - About 3 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 updateCard has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def updateCard
              if @data['old']
                if @data['listAfter']
                  updateCard_moved
                elsif @data['old']['desc']
      Severity: Minor
      Found in plugins/trellolistener.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 start has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start
      
            # prepare config
            config = {}
            begin
      Severity: Major
      Found in lib/cogbot.rb - About 2 hrs to fix

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

              def check_redmine
                @issues ||= Array.new
                api_key = @bot.config.options['cogconf']['redmine']['api_key']
                redmine_url = "%s/issues.json?project_id=%s&limit=20" % [
                  @bot.config.options['cogconf']['redmine']['url'],
        Severity: Minor
        Found in plugins/redmine.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 check_redmine has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def check_redmine
                @issues ||= Array.new
                api_key = @bot.config.options['cogconf']['redmine']['api_key']
                redmine_url = "%s/issues.json?project_id=%s&limit=20" % [
                  @bot.config.options['cogconf']['redmine']['url'],
        Severity: Minor
        Found in plugins/redmine.rb - About 1 hr to fix

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

                def fetch_rss
                  @bot.debug 'Fetching rss'
                  @feeds ||= {}
                  @bot.config.options['cogconf']['rss']['channels'].each do |chan|
                    prefix = chan['prefix']
          Severity: Minor
          Found in plugins/rss.rb - About 1 hr to fix

            Method query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def query(query)
                    url = "https://rubygems.org/api/v1/search.json?query=#{CGI.escape(query)}"
                    back = "Requesting ... \n"
                    begin
                      file = open(url)
            Severity: Minor
            Found in plugins/rubygems.rb - About 35 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 load_plugin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def load_plugin(m, mapping)
                    authorized m do
                      plugin = mapping.downcase.camelize
            
                      file_name = "#{ROOT_DIR}/plugins/#{mapping.downcase}.rb"
            Severity: Minor
            Found in plugins/manager.rb - About 35 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 exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def exec(command,args)
                    commands = {
                      'psaux' => 'ps -aux',
                      'df' => 'df -h',
                      'last' => 'last',
            Severity: Minor
            Found in plugins/exec.rb - About 35 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 listen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def listen(m, json)
                    hash = Yajl::Parser.parse(URI.unescape(json))
                    # bot.loggers.debug(hash.inspect)
                    if @bot.config.options['cogconf']['trello']
                      msg = TrelloMessage.new(hash['action'])
            Severity: Minor
            Found in plugins/trellolistener.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

            Method updateLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def updateLabel
                    if @data['old']
                      if @data['old']['name']
                        "changed label name \"%s\" to \"%s\"" % [
                          format(:orange, @data['old']['name']),
            Severity: Minor
            Found in plugins/trellolistener.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

            Method files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def files(c)
                    back = ""
                    back += '[= ' + short(c['modified']).join(' ') + ' ] ' unless c['modified'].empty?
                    back += '[- ' + short(c['removed']).join(' ') + ' ] ' unless c['removed'].empty?
                    back += '[+ ' + short(c['added']).join(' ') + ' ] ' unless c['added'].empty?
            Severity: Minor
            Found in plugins/gitlistener.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

            Method exec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def exec(query,nick)
                    back ''
                    query.strip! rescue ''
                    nick.strip! rescue ''
                    if query.blank?
            Severity: Minor
            Found in plugins/users.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