redmine/redmine

View on GitHub
bin/changelog.rb

Summary

Maintainability
C
1 day
Test Coverage

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

      def build_output(items, no_of_issues, v_name, r_date, n_branch, target)
        target = target

        output_filename = v_name + '_changelog_for_' + target + '.txt'
        out_file = File.new(output_filename, 'w')
Severity: Minor
Found in bin/changelog.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

File changelog.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'optparse'
require 'ostruct'
require 'date'

VERSION = '1.0.0'
Severity: Minor
Found in bin/changelog.rb - About 2 hrs to fix

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

      def self.parse(args)
        options = OpenStruct.new
        options.version_name = ''
        options.release_date = ''
        options.new_branch = 'auto'
    Severity: Minor
    Found in bin/changelog.rb - About 1 hr to fix

      Method build_output has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_output(items, no_of_issues, v_name, r_date, n_branch, target)
              target = target
      
              output_filename = v_name + '_changelog_for_' + target + '.txt'
              out_file = File.new(output_filename, 'w')
      Severity: Minor
      Found in bin/changelog.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                  if (version[2] != nil && version[2] == '0') ||
                     (version[2] == nil && version[1] != nil) ||
                     (version[2] == nil && version[1] == nil && version[0] != nil)
                    new_branch = true
                  end
        Severity: Major
        Found in bin/changelog.rb - About 1 hr to fix

          Method summary has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def summary(v_name, target, i_cnt, nc_i_cnt, no_of_issues, c_cnt)
          Severity: Minor
          Found in bin/changelog.rb - About 45 mins to fix

            Method build_output has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def build_output(items, no_of_issues, v_name, r_date, n_branch, target)
            Severity: Minor
            Found in bin/changelog.rb - About 45 mins to fix

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

                    def parse_new_branch
                      @version_name =~ VERSION_REGEX
                      version = Array.new([$1, $2, $3])
              
                      case @n_branch
              Severity: Minor
              Found in bin/changelog.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

              There are no issues that match your filters.

              Category
              Status