Showing 836 of 1,675 total issues
Function generate_stylesheet
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.generate_stylesheet = function(opts) {
var styles = '';
var max_size_x = this.options.max_size_x || this.cols;
var max_rows = 0;
var max_cols = 0;
Method show_element_name
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_element_name(element)
if element.attributes.has_key? 'record_status_id'
if element.is_root?
"<span class='#{h element.record_status.to_s }'>#{h element.name} </span>"
else
Method edit
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
set_page_title 'Edit estimation'
@project = Project.find(params[:id])
@organization = @project.organization
Method generate_wbs_project_elt_tree
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_wbs_project_elt_tree(element, tree, show_hidden=false, is_project_show_view=false)
#Root is always display
gap = 2.5
tree ||= String.new
unless element.nil?
- 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 display_text_field_tag
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
est_val_pe_attribute = est_val.pe_attribute
organization = module_project.project.organization
precision = est_val_pe_attribute.precision.nil? ? user_number_precision : est_val_pe_attribute.precision
- 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 collapse_project_version
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def collapse_project_version
projects = Project.find_all_by_id(params[:project_ids])
flash_error = ""
Project.transaction do
projects.each do |project|
- 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 contains
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
'contains': function(node, mpos) {
var pos = node.pos.getc(true),
width = node.getData('width'),
height = node.getData('height'),
algnPos = this.getAlignedPos(pos, width, height),
Function contains
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
'contains': function(node, mpos) {
var pos = node.pos.getc(true),
width = node.getData('width'),
height = node.getData('height'),
algnPos = this.getAlignedPos(pos, width, height),
Function enter
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
enter: function(n){
if(this.busy) return;
this.busy = true;
var that = this,
Function initialize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function(controller) {
var config = {
animate: false,
orientation: "h",
offset: 2,
Function updateJSON
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateJSON: function(json, onComplete) {
if(this.busy) return;
this.busy = true;
var delegate = this.delegate,
Function Bezier
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsPlumb.Connectors.Bezier = function(params) {
params = params || {};
var self = this,
_super = jsPlumb.Connectors.AbstractConnector.apply(this, arguments),
Method duplicate_wbs_activity
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def duplicate_wbs_activity
#Update ancestry depth caching
WbsActivityElement.rebuild_depth_cache!
begin
Function onClick
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
onClick: function (id, options) {
var canvas = this.canvas, that = this, Geom = this.geom, config = this.config;
var innerController = {
Move: {
enable: true,
Function $setRoot
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $setRoot() {
if(this.config.multitree && clickedNode.data.$orn) {
var orn = clickedNode.data.$orn;
var opp = {
'left': 'right',
Function paint
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.paint = function(style) {
if (style !== null) {
var segments = self.getSegments(), p = { "path":"" },
d = [self.x,self.y,self.w,self.h];
Function stopEvent
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function() {
var originalEvent = jpcl.getDropEvent(arguments);
_ju.removeWithFunction(params.endpointsByElement[placeholderInfo.id], function(e) {
return e.id == floatingEndpoint.id;
});
Function onPlaceLabel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
onPlaceLabel: function(domElement, node) {
if(!nodeLabels[node.id]) return;
var labels = nodeLabels[node.id],
wrapperStyle = labels.wrapper.style,
labelStyle = labels.label.style,
Function prepareEndpoint
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareEndpoint = function(existing, index, params, element, elementId, connectorPaintStyle, connectorHoverPaintStyle) {
var e;
if (existing) {
self.endpoints[index] = existing;
existing.addConnection(self);
Function _prepareCompute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var _prepareCompute = function(params) {
self.lineWidth = params.lineWidth;
var segment = jsPlumbUtil.segment(params.sourcePos, params.targetPos),
swapX = params.targetPos[0] < params.sourcePos[0],
swapY = params.targetPos[1] < params.sourcePos[1],