assets/javascripts/code_review.js
File code_review.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
# Code Review plugin for Redmine
# Copyright (C) 2009-2023 Haruyuki Iida
#
# This program is free software; you can redistribute it and/or
Function setAddReviewButton
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
function setAddReviewButton(url, change_id, image_tag, is_readonly, is_diff, attachment_id) {
var filetables = [];
var j = 0;
$('table').each(function () {
if ($(this).hasClass('filecontent')) {
- 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 setAddReviewButton
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setAddReviewButton(url, change_id, image_tag, is_readonly, is_diff, attachment_id) {
var filetables = [];
var j = 0;
$('table').each(function () {
if ($(this).hasClass('filecontent')) {
Function setAddReviewButton
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setAddReviewButton(url, change_id, image_tag, is_readonly, is_diff, attachment_id) {
Function getReviewObjById
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function getReviewObjById(review_id) {
for (var reviewlist in code_reviews_map) {
for (var i = 0; i < reviewlist.length; i++) {
var review = reviewlist[i];
if (review.id == review_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"