Showing 48 of 48 total issues
Method initial_parse_comments
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initial_parse_comments(changeset)
ref_keywords = Setting.commit_ref_keywords
all_hooks = all_applicable_hooks
fix_keywords = all_hooks.map(&:keywords).join(',')
- 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 apply_hooks_for_branch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def apply_hooks_for_branch(changeset, branch)
ref_keywords = Setting.commit_ref_keywords
all_hooks = all_applicable_hooks
fix_keywords = all_hooks.map(&:keywords).join(',')
- 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 hook_custom_field_value_tag
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hook_custom_field_value_tag(name, custom_value)
custom_field = custom_value.custom_field
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
field_name << '[]' if custom_field.multiple?
field_id = "#{name}_custom_field_values_#{custom_field.id}"
Method apply_hooks_to_issue_by_repo_revision
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_hooks_to_issue_by_repo_revision(issue_id, action, repo_revision)
issue = Issue.find_by_id(issue_id)
unless Policies::ApplyHooks.allowed?(repo_revision.committer, issue)
Method lastrev
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def lastrev(path, rev)
return nil if path.nil?
cmd_args = %w{log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1}
cmd_args << rev if rev
cmd_args << '--' << path unless path.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 shell_out
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def shell_out(cmd, &block)
exit_status = nil
errors = nil
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
stdin.set_encoding('ASCII-8BIT') if stdin.respond_to?(:set_encoding)
- 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 annotate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def annotate(path, identifier = nil)
identifier = 'HEAD' if identifier.blank?
cmd_args = %w{blame --encoding=UTF-8}
cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
blame = Annotate.new
- 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 fetch_changesets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fetch_changesets
fetch_start = Time.now
init_scm
scm.fetch!
- 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 annotate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def annotate(path, identifier = nil)
identifier = 'HEAD' if identifier.blank?
cmd_args = %w{blame --encoding=UTF-8}
cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
blame = Annotate.new
Method parse_comment_for_issues
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_comment_for_issues(ref_keywords, fix_keywords)
ret = { ref_issues: [], fix_issues: {}, log_time: {} }
return ret if comments.blank?
Method diff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def diff(path, identifier_from, identifier_to = nil)
path ||= ''
cmd_args = []
if identifier_to
cmd_args << 'diff' << '--no-color' << identifier_to << identifier_from
- 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 show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show
begin
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
rescue
end
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(url, root_url, login=nil, password=nil, path_encoding=nil)
Method revisions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def revisions(path, identifier_from, identifier_to, options = {}, &block)
Method revisions_in_chunks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def revisions_in_chunks(path, identifier_from, identifier_to, options = {}, &block)
Method fetch_changesets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_changesets
Project.active.has_module(:repository).each do |project|
project.repositories.each do |repository|
begin
if self.fetch_by_web_hook?(repository)
- 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 handle_push_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_push_event
return unless push_event?
repos = find_repositories
if repos.any?
fetch_repositories(repos)
- 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 link_revision_to_issue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link_revision_to_issue(revision, issue_id)
return unless issue_id
user = user_by_email(revision.cemail) || User.anonymous
- 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 hook_custom_field_value_tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hook_custom_field_value_tag(name, custom_value)
custom_field = custom_value.custom_field
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
field_name << '[]' if custom_field.multiple?
field_id = "#{name}_custom_field_values_#{custom_field.id}"
- 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 create_mappings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_mappings
new_urls = []
Repository::Git.order(:id).map do |r|
old_repo = Repo.new(
id: r.id,
- 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"