bin/changelog.rb
Method build_output
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
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')
- Read upRead up
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
Open
require 'optparse'
require 'ostruct'
require 'date'
VERSION = '1.0.0'
Method parse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(args)
options = OpenStruct.new
options.version_name = ''
options.release_date = ''
options.new_branch = 'auto'
Method build_output
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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')
Consider simplifying this complex logical expression. Open
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
Method summary
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def summary(v_name, target, i_cnt, nc_i_cnt, no_of_issues, c_cnt)
Method build_output
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_output(items, no_of_issues, v_name, r_date, n_branch, target)
Method parse_new_branch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_new_branch
@version_name =~ VERSION_REGEX
version = Array.new([$1, $2, $3])
case @n_branch
- Read upRead up
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"