Showing 836 of 1,675 total issues
Method add_wbs_activity_to_project
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def add_wbs_activity_to_project
@project = Project.find(params[:project_id])
@pe_wbs_project_activity = @project.pe_wbs_projects.activities_wbs.first
@wbs_project_elements_root = @project.wbs_project_element_root
- 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 getAlignedPos
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getAlignedPos: function(pos, width, height) {
var nconfig = this.node;
var square, orn;
if(nconfig.align == "center") {
square = {
Function onCreateLabel
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onCreateLabel: function(domElement, node) {
var labelConf = config.Label,
valueArray = node.getData('valueArray'),
acum = $.reduce(valueArray, function(x, y) { return x + y; }, 0);
var nlbs = {
Function multipleColumns
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
multipleColumns: function( c, $input ) {
// look for multiple columns "1-3,4-6,8" in data-column
var ranges, singles, indx,
wo = c.widgetOptions,
// only target "all" column inputs on initialization
Function spectrum
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.fn.spectrum = function (opts, extra) {
if (typeof opts == "string") {
var returnValue = this;
Function paint
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.paint = function(params, containerExtents) {
if (path == null) {
path = _node("path");
params.connector.svg.appendChild(path);
self.attachListeners(path, params.connector);
Function makeAnchor
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.makeAnchor = function() {
var _a = function(t, p) {
if (jsPlumb.Anchors[t]) return new jsPlumb.Anchors[t](p);
if (!_currentInstance.Defaults.DoNotThrowErrors)
throw { msg:"jsPlumb: unknown anchor type '" + t + "'" };
Function on_start_drag
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fn.on_start_drag = function(event, ui) {
this.$helper.add(this.$player).add(this.$wrapper).addClass('dragging');
this.highest_col = this.get_highest_occupied_cell().col;
Function drag_handler
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fn.drag_handler = function(e) {
var node = e.target.nodeName;
// skip if drag is disabled, or click was not done with the mouse primary button
if (this.disabled || e.which !== 1 && !isTouch) {
return;
Function animationLoop
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function animationLoop(config, drawScale, drawData, ctx, clrx, clry, clrwidth, clrheight, midPosX, midPosY, borderX, borderY, data) {
var cntiter=0;
if (isIE() < 9 && isIE() != false) config.animation = false;
Method display_balancing_output
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def display_balancing_output(module_project)
#pbs_project_element = @pbs_project_element || @project.root_component
pbs_project_element = current_component
res = String.new
Method create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create
authorize! :manage, User
set_page_title 'New user'
Function format
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
format: function(table, c, wo, init) {
var stored, time,
$table = c.$table,
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
sortList = { "sortList" : c.sortList };
Function toggleStylesOn
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toggleStylesOn: function(type, node, set) {
var viz = this.viz;
var nStyles = this.nStyles;
if(set) {
var that = this;
Function onMouseMove
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onMouseMove: function(e, win, event) {
//if mouse button is down and moving set move=true
if(this.down) this.move = true;
//already handled by mouseover/out
if(this.dom && this.isLabel(e, win)) return;
Function plotStep
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
plotStep: function(delta, controller, animating) {
var viz = this.viz,
config = this.config,
canvas = viz.canvas,
ctx = canvas.getCtx(),
Function updateHelperLocations
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateHelperLocations() {
var s = currentSaturation;
var v = currentValue;
if(allowEmpty && isEmpty) {
Function _updateAnchorList
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var _updateAnchorList = function(lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, elId, connsToPaint, endpointsToPaint) {
// first try to find the exact match, but keep track of the first index of a matching element id along the way.s
var exactIdx = -1,
firstMatchingElIdx = -1,
endpoint = conn.endpoints[idx],
Function detach
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.detach = function() {
if (arguments.length == 0) return;
var connType = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),
firstArgIsConnection = arguments[0].constructor == connType,
Function stopEvent
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dragOptions[stopEvent] = _wrap(dragOptions[stopEvent], function() {
if (existingStop) existingStop.apply(this, arguments);
//_currentlyDown = false;
_currentInstance.currentlyDragging = false;