File GridView.js
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
Ext.ux.maximgb.tg.GridView = Ext.extend(Ext.grid.GridView,
{
expanded_icon_class : 'ux-maximgb-tg-elbow-minus',
last_expanded_icon_class : 'ux-maximgb-tg-elbow-end-minus',
collapsed_icon_class : 'ux-maximgb-tg-elbow-plus',
Function doRender
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
doRender : function(cs, rs, ds, startRow, colCount, stripe)
{
var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
var tstyle = 'width:'+this.getTotalWidth()+';';
// buffers
- 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 renderCellTreeUI
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
renderCellTreeUI : function(record, store)
{
var tpl = this.templates.treeui,
line_tpl = this.templates.elbow_line,
tpl_data = {},
- 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 renderCellTreeUI
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCellTreeUI : function(record, store)
{
var tpl = this.templates.treeui,
line_tpl = this.templates.elbow_line,
tpl_data = {},
Function doRender
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
doRender : function(cs, rs, ds, startRow, colCount, stripe)
{
var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
var tstyle = 'width:'+this.getTotalWidth()+';';
// buffers
Function initTemplates
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
initTemplates : function()
{
var ts = this.templates || {};
if (!ts.row) {
Function expandRow
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
expandRow : function(record, skip_process)
{
var ds = this.ds,
i, len, row, pmel, children, index, child_index;
- 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 expandRow
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
expandRow : function(record, skip_process)
{
var ds = this.ds,
i, len, row, pmel, children, index, child_index;
Function collapseRow
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
collapseRow : function(record, skip_process)
{
var ds = this.ds,
i, len, children, row, index, child_index;
Function updateAllColumnWidths
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
updateAllColumnWidths : function()
{
var tw = this.getTotalWidth(),
clen = this.cm.getColumnCount(),
ws = [],
- 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 collapseRow
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
collapseRow : function(record, skip_process)
{
var ds = this.ds,
i, len, children, row, index, child_index;
- 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 updateColumnHidden
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
updateColumnHidden : function(col, hidden)
{
var tw = this.getTotalWidth();
this.innerHd.firstChild.style.width = this.getOffsetWidth();
this.innerHd.firstChild.firstChild.style.width = tw;
- 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 updateAllColumnWidths
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateAllColumnWidths : function()
{
var tw = this.getTotalWidth(),
clen = this.cm.getColumnCount(),
ws = [],
Function updateColumnWidth
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
updateColumnWidth : function(col, width)
{
var w = this.getColumnWidth(col);
var tw = this.getTotalWidth();
this.innerHd.firstChild.style.width = this.getOffsetWidth();
- 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 doRender
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
doRender : function(cs, rs, ds, startRow, colCount, stripe)
Function renderRow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
renderRow : function(record, index, col_count, ds, total_width)
Function initTemplates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
initTemplates : function()
{
var ts = this.templates || {};
if (!ts.row) {
- 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 ensureVisible
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ensureVisible : function(row, col, hscroll)
{
var ancestors, record = this.ds.getAt(row);
if (!this.ds.isVisibleNode(record)) {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
Ext.ux.maximgb.tg.GridView = Ext.extend(Ext.grid.GridView,
{
expanded_icon_class : 'ux-maximgb-tg-elbow-minus',
last_expanded_icon_class : 'ux-maximgb-tg-elbow-end-minus',
collapsed_icon_class : 'ux-maximgb-tg-elbow-plus',
- 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 4845.
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