Tomohiro/redmine_irc_gateway

View on GitHub

Showing 4 of 4 total issues

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

        def connection(refresh = false)
          if connection = self.connections[session.profile]
            connection
          else
            begin
Severity: Minor
Found in lib/redmine_irc_gateway/redmine/api.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 build_issue_description has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def build_issue_description(issue, updated = false)
      speaker = (updated ? issue.updated_by : (issue.assigned_to || issue.author)).name.gsub(' ', '')
      reply_to = if issue.assigned_to and speaker != issue.assigned_to.name.gsub!(' ', '')
                   ' @' + issue.assigned_to.name
                 else
Severity: Minor
Found in lib/redmine_irc_gateway/command.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 crawl_recent_issues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def crawl_recent_issues(interval = 300)
      Thread.new do
        loop do
          @user.connect_redmine
          Command.recent.each do |issue|
Severity: Minor
Found in lib/redmine_irc_gateway/session.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(command, id)
      unless @commands[command.to_sym]
        raise NotImplementedError, 'Command not found'
      end

Severity: Minor
Found in lib/redmine_irc_gateway/command.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