Showing 1,675 of 1,675 total issues
Function buildParserCache
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildParserCache(table) {
var c = table.config,
// update table bodies in case we start with an empty table
tb = c.$tbodies = c.$table.children('tbody:not(.' + c.cssInfoBlock + ')'),
rows, list, l, i, h, ch, p, parsersDebug = "";
Function resize_widget
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.resize_widget = function($widget, size_x, size_y, callback) {
var wgd = $widget.coords().grid;
var col = wgd.col;
var max_cols = this.options.max_cols;
var old_size_y = wgd.size_y;
Function updateNavArrows
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateNavArrows: function() {
if (!this._allow_update) return;
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
Function set_player
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.set_player = function(col, row, no_player) {
var self = this;
if (!no_player) {
this.empty_cells_player_occupies();
}
Function get_valid_rows
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) {
var p_top_row = widget_grid_data.row;
var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
var size_y = widget_grid_data.size_y;
var r = min_row - 1;
Method import_user_from_ldap_mail
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_user_from_ldap_mail(ldap_cn, email, ldap_server)
login_filter = Net::LDAP::Filter.eq ldap_server.email_attribute, "#{email}"
object_filter = Net::LDAP::Filter.eq 'objectClass', '*'
#is_an_automatic_account_activation? ? status = 'active' : 'pending'
Method import_user_from_ldap
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_user_from_ldap(ldap_cn, login, ldap_server)
login_filter = Net::LDAP::Filter.eq ldap_server.user_name_attribute, "#{login}"
object_filter = Net::LDAP::Filter.eq 'objectClass', '*'
#is_an_automatic_account_activation? ? status = 'active' : status = 'pending'
Function defMouse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defMouse(ctx,data,config,tpgraph) {
if (config.annotateDisplay == true) {
if (cursorDivCreated == false) oCursor = new makeCursorObj('divCursor');
if (isIE() < 9 && isIE() != false) ctx.canvas.attachEvent("on" + config.annotateFunction.split(' ')[0], function (event) {
Method show
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@project = Project.find(params[:id])
@organization = @project.organization
Method perform
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(pbs_project_elt_id, estimation_value_id)
#No authorize required since this method is private and won't be call from any route
pbs_project_elt = PbsProjectElement.find(pbs_project_elt_id)
estimation_value = EstimationValue.find(estimation_value_id)
Similar blocks of code found in 2 locations. Consider refactoring. Open
ActiveRecord::Base.transaction do
ancestors = []
ext_ancestry = ext.ancestry
unless ext_ancestry.nil?
ext_ancestry_list = ext.ancestry.split('/')
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 54.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
ActiveRecord::Base.transaction do
ancestors = []
ext_ancestry = ext_elt.ancestry
unless ext_ancestry.nil?
ext_ancestry_list = ext_elt.ancestry.split('/')
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 54.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function onComplete
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
onComplete: function() {
//compute positions of newly inserted nodes
if(config.request)
that.compute();
Function normalizeDims
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalizeDims: function() {
//number of elements
var root = this.delegate.graph.getNode(this.delegate.root), l=0;
root.eachAdjacency(function() {
l++;
Function onPlaceLabel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
onPlaceLabel: function(domElement, node) {
if(!config.showLabels) return;
var pos = node.pos.getp(true),
dimArray = node.getData('dimArray'),
span = node.getData('span') / 2,
Function contract
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
contract: function(node, opt) {
var viz = this.viz;
if(node.collapsed || !node.anySubnode($.lambda(true))) return;
opt = $.merge(this.options, viz.config, opt || {}, {
'modes': ['node-property:alpha:span', 'linear']
Function hideFilters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
hideFilters: function(table, c) {
var $filterRow, $filterRow2, timer;
$(table)
.find('.' + ts.css.filterRow)
.addClass('hideme')
Function getConnections
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.getConnections = function(options, flat) {
if (!options) {
options = {};
} else if (options.constructor == String) {
options = { "scope": options };
Function detach
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.detach = function(connection, ignoreTarget, forceDetach, fireEvent, originalEvent) {
var idx = _ju.findWithFunction(self.connections, function(c) { return c.id == connection.id}),
actuallyDetached = false;
fireEvent = (fireEvent !== false);
if (idx >= 0) {
Function can_go_player_up
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
fn.can_go_player_up = function(widget_grid_data) {
var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
var result = true;
var upper_rows = [];
var min_row = 10000;