app/assets/javascripts/userDeleteConfirmBox.js
Function showConfirmDialogSpecial
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.rails.showConfirmDialogSpecial = function(link) {
var message = link.attr('data-confirm');
var html1 = "<div class=\"modal\" id=\"dialog-confirm1\" title=\"Delete This User?\">\n <div class=\"modal-body\">\n <p>" + message + "</p>\n";
var html2 = "<div class=\"modal\" id=\"dialog-confirm2\" title=\"System Information\">\n <div class=\"modal-body\">\n <p>This user cannot be deleted. Do you want to rename the user account to <b>" + link.attr('data-username') + "_hidden</b>?</p>\n";
Function Yes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"Yes": function() {
//return $.rails.confirmed(link);
$( this ).dialog( "close" );
$(html2).modal();
$("#dialog-confirm2").dialog({
Function allowAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
$.rails.allowAction = function(link) {
//use normal confirm dialog, when link does not have 'data-overridden' attribute.
if (!link.attr("confirm")){
if (link.attr('data-confirm')){
if (link.attr('data-overridden')){
- 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"