Showing 419 of 572 total issues
Method create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
if !@assessment.allow_student_assign_group && @cud.student?
flash[:error] = "You are not allowed to self-assign group for this assessment. "\
"Contact your instructor for group assignment."
redirect_to(action: :new) && return
- 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 action_auth_level
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.action_auth_level(action, level)
raise ArgumentError, "The action must be specified." if action.nil?
raise ArgumentError, "The action must be symbol." unless action.is_a? Symbol
raise ArgumentError, "The level must be specified." if level.nil?
raise ArgumentError, "The level must be symbol." unless level.is_a? Symbol
- 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 handout
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handout
# If the logic here changes, do update assessment#has_handout?
begin
extend_config_module(@assessment, nil, @cud)
rescue StandardError => e
- 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
Function EditorLock
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EditorLock() {
var activeEditController = null;
/***
* Returns true if a specified edit controller is active (has the edit lock).
Function SVGGraphics_paintInlineImageXObject
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SVGGraphics_paintInlineImageXObject(imgData, mask) {
var current = this.current;
var width = imgData.width;
var height = imgData.height;
Function drawFigure
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawFigure(data, figure, context) {
var ps = figure.coords;
var cs = figure.colors;
var i, ii;
switch (figure.type) {
Function bindEvents
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindEvents: function () {
var s = this;
// bind the close event to any element with the closeClass class
$('.' + s.o.closeClass).bind('click.simplemodal', function (e) {
Method show
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
allowed = [:name, :display_name, :description, :start_at, :due_at, :end_at, :updated_at, :max_grace_days,
:max_submissions, :disable_handins, :category_name, :group_size, :writeup_format, :handout_format,
:has_scoreboard, :has_autograder, :max_unpenalized_submissions, :max_total_score, :max_scores]
Function getRowDiffs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getRowDiffs(rows, newRows) {
var item, r, eitherIsNonData, diff = [];
var from = 0, to = newRows.length;
if (refreshHints && refreshHints.ignoreDiffsBefore) {
Function getColumnCssRules
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getColumnCssRules(idx) {
if (!stylesheet) {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if ((sheets[i].ownerNode || sheets[i].owningElement) == $style[0]) {
Function transportObj
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
messageHandler.on('commonobj', function transportObj(data) {
var id = data[0];
var type = data[1];
if (this.commonObjs.hasData(id)) {
return;
Function append
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
append: function (item) {
var self = this;
var $tag = self.compiled.tag({ 'item': item });
if (self.value.some(function (selectedItem) {
Method saveHandin
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def saveHandin(sub, app_id = nil)
unless @assessment.has_groups?
submission = @assessment.submissions.create!(course_user_datum_id: @cud.id,
submitter_ip: request.remote_ip,
submitted_by_app_id: app_id)
Method scoreboardOrderSubmissions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scoreboardOrderSubmissions(a, b)
# If the assessment is not autograded, or the instructor did
# not create a custom column spec, then revert to the default,
# which sorts by total problem, then by submission time.
if !@assessment.has_autograder? ||
Method autograde_done
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def autograde_done
@assessment = @course.assessments.find_by(name: params[:name])
head(:no_content) && return unless @assessment && @assessment.has_autograder?
ASSESSMENT_LOGGER.setAssessment(@assessment)
Method download_tar
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download_tar
path = params[:path]&.split("/")&.drop(2)&.join("/")
path = CGI.unescape(path)
absolute_path = check_path_exist(path)
return unless check_instructor(absolute_path)
Method upload_file
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_file(path)
absolute_path = check_path_exist(path)
if Archive.in_dir?(BASE_DIRECTORY, absolute_path, strict: false)
raise "You cannot upload files/create folders in the root directory click " \
"#{view_context.link_to 'here', new_course_url, method: 'get'}" \
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var self = this;
if (self.options.dropdown.el) {
self.$dropdown = $('*').find(self.options.dropdown.el);
Function CachedCanvasesClosure
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
var CachedCanvases = (function CachedCanvasesClosure() {
var cache = {};
return {
getCanvas: function CachedCanvases_getCanvas(id, width, height,
trackTransform) {
Function absBox
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function absBox(elem) {
var box = {
top: elem.offsetTop,
left: elem.offsetLeft,
bottom: 0,