Showing 3,486 of 3,486 total issues
Function initFields
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
initFields: function(){
var cm = this.grid.getColumnModel(), pm = Ext.layout.ContainerLayout.prototype.parseMargins;
this.removeAll(false);
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
var c = cm.getColumnAt(i),
- 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 setActiveTab
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
setActiveTab : function(item){
item = this.getComponent(item);
if(this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
return;
}
- 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 sortData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
sortData: function () {
var sortInfo = this.hasMultiSort ? this.multiSortInfo : this.sortInfo,
direction = sortInfo.direction || "ASC",
sorters = sortInfo.sorters,
sortFns = [];
- 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 setActiveTab
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
setActiveTab : function(item){
item = this.getComponent(item);
if(this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
return;
}
- 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 tab_me
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def tab_me(paths)
paths = [paths] unless paths.class.name == "Array"
paths.each do |path|
case path.class.name
- 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 update_statistics
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update_statistics(options)
aa_size = nil
return unless respond_to? :call_down_messages
if options[:response] && options[:response].to_i > 0
- 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 create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create
paramsWithCSVInvitees unless params[:invitation][:csvfile].blank?
params[:invitation].delete("csvfile")
params[:invitation][:author_id] = current_user.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"
Further reading
Method recent_posts
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def recent_posts
params[:forums].delete('')
forums = if params[:forums].blank?
Forum.for_user(current_user)
else
- 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 normalize_record
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def normalize_record(record)
return nil unless record['DN'] && record['displayName'] && record['mail']
jur=ou_to_jur(record['DN'])
displayname=record['displayName'].split(/\s/).reject{|item| item.blank?}.join(" ")
- 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 initComponent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
initComponent: function(){
this.setTitle(this.state == 'new' ? 'New Role' : 'Edit Role');
var form_opts = {};
if(this.state == 'new'){
Function renderElements
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderElements : function(n, a, targetNode, bulkRender){
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
var t = n.getOwnerTree();
var cols = t.columns;
Function constructor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor: function(tree, config){
/**
* @cfg {Boolean} folderSort True to sort leaf nodes under non-leaf nodes (defaults to false)
*/
/**
Function toggleSourceEdit
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
toggleSourceEdit : function(sourceEditMode){
var iframeHeight,
elHeight;
if (sourceEditMode === undefined) {
Function constrainXY
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
constrainXY : function(){
if(this.constrain){
var vw = Ext.lib.Dom.getViewWidth(),
vh = Ext.lib.Dom.getViewHeight();
var s = Ext.getDoc().getScroll();
Function slideOut
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
slideOut : function(){
if(this.isSlid || this.el.hasActiveFx()){
return;
}
this.isSlid = true;
Function ghost
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ghost : function(anchor, o){
o = getObject(o);
var me = this,
dom = me.dom,
st = dom.style,
Function init
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
init : function() {
var me = this;
// Some arrays we are going to store data in
this.values = [];
Function update
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update(event) {
if($.tooltip.blocked)
return;
if (event && event.target.tagName == "OPTION") {
Method approve
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def approve
role_req=RoleRequest.find(params[:id])
if role_req
if current_user.is_admin_for?(role_req.jurisdiction)
role_req.approve!(current_user)
Identical blocks of code found in 2 locations. Consider refactoring. Open
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
- 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 66.
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