Class Repository
has 61 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository < ApplicationRecord
include Redmine::Ciphering
include Redmine::SafeAttributes
# Maximum length for repository identifiers
File repository.rb
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ScmFetchError < StandardError; end
class Repository < ApplicationRecord
include Redmine::Ciphering
include Redmine::SafeAttributes
Method committer_ids=
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def committer_ids=(h)
if h.is_a?(Hash)
committers.each do |committer, user_id|
new_user_id = h[committer]
if new_user_id && (new_user_id.to_i != user_id.to_i)
- 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 find_committer_user
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def find_committer_user(committer)
unless committer.blank?
@found_committer_users ||= {}
return @found_committer_users[committer] if @found_committer_users.has_key?(committer)
- 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 stats_by_author
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stats_by_author
commits = Changeset.where("repository_id = ?", id).
select("committer, user_id, count(*) as count").group("committer, user_id")
# TODO: restore ordering ; this line probably never worked
# commits.to_a.sort! {|x, y| x.last <=> y.last}
- 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"