Showing 12 of 12 total issues
Method organize_lines
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def organize_lines(delta, patch)
lines_to_walk = []
# if whole file was changed examine one time only
whole_file_changed = (delta.old_file[:oid] == MetaCommit::Git::Repo::FILE_NOT_EXISTS_OID) || (delta.new_file[:oid] == MetaCommit::Git::Repo::FILE_NOT_EXISTS_OID)
skip_walking = false
- 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
Method examine_diff
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def examine_diff(repo, left_commit, right_commit)
diffs = []
repo_diff = repo.diff(left_commit, right_commit, MetaCommit::Git::Repo::DIFF_OPTIONS)
diff_lines = @diff_lines_provider.from(repo_diff)
diff_lines.each do |(old_file_path, new_file_path, patch, line)|
- 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
Method index_meta
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def index_meta(repo)
diffs = MetaCommit::Models::Changes::Commit.new(repo.last_commit_oid, 'staged')
repo_diff = repo.index_diff(MetaCommit::Git::Repo::INDEX_DIFF_OPTIONS)
diff_lines = @diff_lines_provider.from(repo_diff)
diff_lines.each do |(old_file_path, new_file_path, patch, line)|
- 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
Method meta
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def meta(repo, left_commit, right_commit)
diffs = []
commit_id_old = left_commit.oid
commit_id_new = right_commit.oid
repo_diff = repo.diff(left_commit, right_commit, MetaCommit::Git::Repo::DIFF_OPTIONS)
- 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
Method build
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build
result = [version_entry]
result += [added_changes_group_entry] unless @added_changes.empty?
result += [changed_changes_group_entry] unless @changed_changes.empty?
result += [deprecated_changes_group_entry] unless @deprecated_changes.empty?
- 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
Method organize_lines
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def organize_lines(delta, patch)
lines_to_walk = []
# if whole file was changed examine one time only
whole_file_changed = (delta.old_file[:oid] == MetaCommit::Git::Repo::FILE_NOT_EXISTS_OID) || (delta.new_file[:oid] == MetaCommit::Git::Repo::FILE_NOT_EXISTS_OID)
skip_walking = false
Method meta
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def meta(repo, left_commit, right_commit)
diffs = []
commit_id_old = left_commit.oid
commit_id_new = right_commit.oid
repo_diff = repo.diff(left_commit, right_commit, MetaCommit::Git::Repo::DIFF_OPTIONS)
Method index_meta
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index_meta(repo)
diffs = MetaCommit::Models::Changes::Commit.new(repo.last_commit_oid, 'staged')
repo_diff = repo.index_diff(MetaCommit::Git::Repo::INDEX_DIFF_OPTIONS)
diff_lines = @diff_lines_provider.from(repo_diff)
diff_lines.each do |(old_file_path, new_file_path, patch, line)|
Method examine_diff
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def examine_diff(repo, left_commit, right_commit)
diffs = []
repo_diff = repo.diff(left_commit, right_commit, MetaCommit::Git::Repo::DIFF_OPTIONS)
diff_lines = @diff_lines_provider.from(repo_diff)
diff_lines.each do |(old_file_path, new_file_path, patch, line)|
Method compute_column
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def compute_column(old_file_content, new_file_content)
return if old_file_content.empty? || new_file_content.empty?
return if old_lineno == -1 || new_lineno == -1
old_file_lines = old_file_content.lines.map(&:chomp)
- 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
Method collect_path_to_ast_at_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect_path_to_ast_at_line(ast, lineno, accumulator)
return ast if lineno == WHOLE_FILE
return nil if ast.nil? || (lines?(ast) && !covers_line?(ast, lineno))
closest_ast = ast
- 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
Method write_repository_change_chunk
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_repository_change_chunk(repo, diffs)
message_builder = changelog_message_builder(@tag, @date)
diffs.each do |diff|
message_builder.add_to_added(diff.string_representation) if diff.type_addition?
message_builder.add_to_removed(diff.string_representation) if diff.type_deletion?
- 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"