Showing 37 of 77 total issues
Method perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform
start = Time.zone.now
invite_status.creating_repo!
Broadcaster.call(exercise, :create_repo, :text)
- 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_http_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_http_request(endpoint, method, headers, query, body)
Method create_repo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_repo
job_started = false
if current_invitation_status.accepted? || current_invitation_status.errored?
assignment_repo = AssignmentRepo.find_by(assignment: current_assignment, user: current_user)
assignment_repo&.destroy if assignment_repo&.github_repository&.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 route_based_on_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def route_based_on_status
case current_invitation_status.status
when "unaccepted"
redirect_to assignment_invitation_path(current_invitation) if action_name != "show"
when "completed"
- 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
Avoid too many return
statements within this method. Open
return false unless lti_message.resource_link_id
Method perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform(assignment, collaborator, retries: 0)
return unless assignment.invitation.status(collaborator).waiting?
service = CreateGitHubRepoService.new(assignment, collaborator)
result = service.perform
raise CreateGitHubRepoService::Result::Error, result.error if result.failed?
- 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 authenticate_user!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_user!
if logged_in?
return log_out_and_flash unless current_user.authorized_access_token?
return become_active if adequate_scopes?
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 create_repo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_repo
job_started =
if group_invite_status.accepted? || group_invite_status.errored?
if repo_ready?
group_invite_status.completed!
- 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 users_with_admin_org_hook_scope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def users_with_admin_org_hook_scope
return @users_with_scope if defined?(@users_with_scope)
@users_with_scope = []
- 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 transfer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transfer
return false unless user_owns_any_assignments?
organization.all_assignments.each do |assignment|
next unless assignment.creator_id == old_user.id
assignment.update(creator_id: new_user.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 add_students
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_students
if params[:lms_user_ids].is_a? String
params[:lms_user_ids] = params[:lms_user_ids].split
end
identifiers = params[:identifiers].split("\r\n").reject(&:blank?)
- 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 redeem_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redeem_for(invitee)
return reason_for_disabled_invitations unless enabled?
if (repo_access = RepoAccess.find_by(user: invitee, organization: organization))
assignment_repo = AssignmentRepo.find_by(assignment: assignment, repo_access: repo_access)
- 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 validate_starter_code_repository_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_starter_code_repository_id(repo_id)
valid_integer_or_number_string = repo_id.is_a?(Integer) || (repo_id.is_a?(String) && repo_id.to_s =~ /^[0-9]+$/)
raise GitHub::Error, INVALID_SELECTION unless valid_integer_or_number_string
possible_github_repository = GitHubRepository.new(current_user.github_client, repo_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 descendents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def descendents(scope)
if parent_scope?(scope)
return SCOPE_TREE[scope].keys.map do |child|
[child, descendents(child)]
end.flatten
- 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 ensure_webhook_is_active!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_webhook_is_active!(client: nil)
client ||= admin_org_hook_scoped_github_client
retrieve_org_hook_id!(client) if github_id.blank?
return create_org_hook!(client) if github_id.blank?
github_org_hook_is_active = github_org_hook(client).active?
- 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 perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform(payload_body)
return true unless payload_body.dig("action") == "member_removed"
github_user_id = payload_body.dig("membership", "user", "id")
github_organization_id = payload_body.dig("organization", "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 perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform(payload_body)
return true unless payload_body["action"] == "removed"
user_id = payload_body.dig("member", "id")
team_id = payload_body.dig("team", "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"