keepcosmos/terjira

View on GitHub

Showing 92 of 92 total issues

Class has too many lines. [152/100]
Open

  class IssueCLI < BaseCLI
    no_commands do
      def client_class
        Client::Issue
      end
Severity: Minor
Found in lib/terjira/issue_cli.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for suggest_options is too high. [42.94/20]
Open

    def suggest_options(opts = {})
      origin = options.dup
      self.with_editor = origin.delete(:editor)

      if opts[:required].is_a? Array
Severity: Minor
Found in lib/terjira/option_supportable.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for redner_project_detail is too high. [32.31/20]
Open

    def redner_project_detail(project)
      head = nil
      rows = []
      rows << (pastel.blue.bold(project.key) + ' ' + project.name)
      if project.respond_to?(:description)

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [39/30]
Open

    def issue_detail_template
      %{<%= bold(issue.key) + ' in ' + issue.project.name %>

      <%= bold(issue.summary) %>

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for build_auth_options_by_tty is too high. [28.44/20]
Open

      def build_auth_options_by_tty(options = {})
        puts 'Login will be required...'
        prompt = TTY::Prompt.new

        result = prompt.collect do

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for new_version_exists? is too high. [23.96/20]
Open

      def new_version_exists?
        current = Terjira::VERSION.split(".").map(&:to_i)
        remote = parse_remote_version

        (current[0] < remote[0]) ||
Severity: Minor
Found in lib/terjira/version.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for suggest_related_value_options is too high. [22.2/20]
Open

    def suggest_related_value_options(opts = {})
      if opts[:issuetype]
        if opts[:issuetype].key_value.casecmp('epic').zero?
          # Suggest epic name
          epic_name_field = Client::Field.epic_name
Severity: Minor
Found in lib/terjira/option_supportable.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Cyclomatic complexity for new_version_exists? is too high. [7/6]
Open

      def new_version_exists?
        current = Terjira::VERSION.split(".").map(&:to_i)
        remote = parse_remote_version

        (current[0] < remote[0]) ||
Severity: Minor
Found in lib/terjira/version.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method issue_detail_template has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def issue_detail_template
      %{<%= bold(issue.key) + ' in ' + issue.project.name %>

      <%= bold(issue.summary) %>

Severity: Minor
Found in lib/terjira/presenters/issue_presenter.rb - About 1 hr to fix

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

        def purge_dir(dir)
          Dir.foreach(dir) do |f|
            next if f =~ /^\.\.?$/
            path = File.join(dir, f)
            if File.directory?(path)
    Severity: Minor
    Found in lib/terjira/utils/file_cache.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 suggest_related_value_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def suggest_related_value_options(opts = {})
          if opts[:issuetype]
            if opts[:issuetype].key_value.casecmp('epic').zero?
              # Suggest epic name
              epic_name_field = Client::Field.epic_name
    Severity: Minor
    Found in lib/terjira/option_supportable.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 suggest_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def suggest_options(opts = {})
          origin = options.dup
          self.with_editor = origin.delete(:editor)
    
          if opts[:required].is_a? Array
    Severity: Minor
    Found in lib/terjira/option_supportable.rb - About 1 hr to fix

      Method select_issue_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def select_issue_status
            fetch(:status) do
              statuses = fetch(:statuses) do
                project = if issue = get(:issue)
                            if issue.respond_to?(:project)
      Severity: Minor
      Found in lib/terjira/option_support/option_selector.rb - About 55 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 colorize_priority has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def colorize_priority(priority, opts = {})
            return '' unless priority.respond_to? :name
            name = priority.name
            infos = if name =~ /high|major|critic/i
                      [:red, '⬆']
      Severity: Minor
      Found in lib/terjira/presenters/issue_presenter.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 option_select_prompt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def option_select_prompt
            return @_option_select_prompt if @_option_select_prompt
            @_option_select_prompt = TTY::Prompt.new(help_color: :cyan)
            @_option_select_prompt.on(:keypress) do |event|
              # emacs key binding
      Severity: Minor
      Found in lib/terjira/option_support/option_selector.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 build_auth_options_by_tty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_auth_options_by_tty(options = {})
              puts 'Login will be required...'
              prompt = TTY::Prompt.new
      
              result = prompt.collect do
      Severity: Minor
      Found in lib/terjira/client/auth_option_builder.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 render_projects_summary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_projects_summary(projects)
            return render('Nothing.') if projects.blank?
            head = %w(KEY NAME TYPE).map do |v|
              { value: v, alignment: :center }
            end
      Severity: Minor
      Found in lib/terjira/presenters/project_presenter.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 select_assignee has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def select_assignee
            fetch(:assignee) do
              users = fetch(:users) do
                if issue = get(:issue)
                  Client::User.assignables_by_issue(issue)
      Severity: Minor
      Found in lib/terjira/option_support/option_selector.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 suggest_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def suggest_options(opts = {})
            origin = options.dup
            self.with_editor = origin.delete(:editor)
      
            if opts[:required].is_a? Array
      Severity: Minor
      Found in lib/terjira/option_supportable.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 issue_estimate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def issue_estimate(issue)
            field = Client::Field.story_points
            story_points = issue.try(field.key) if field.respond_to? :key
            return ['Story Points', story_points] if story_points
      
      
      Severity: Minor
      Found in lib/terjira/presenters/issue_presenter.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