Showing 289 of 289 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
(ce.prototype.setScrollLeft = function(e) {
this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e),
this.disableHoriz &&
this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz")
}),
- 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 79.
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
(ce.prototype.setScrollTop = function(e) {
this.vert.scrollTop != e && (this.vert.scrollTop = e),
this.disableVert &&
this.enableZeroWidthBar(this.vert, this.disableVert, "vert")
}),
- 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 79.
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 showPrimarySelection
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
(_e.prototype.showPrimarySelection = function() {
var e = window.getSelection(),
t = this.cm,
r = t.doc.sel.primary(),
o = r.from(),
Function init
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
;(Ve.prototype.init = function(e) {
function prepareCopyCut(e) {
if (!signalDOMEvent(r, e)) {
if (r.somethingSelected())
setLastCopied({ lineWise: !1, text: r.getSelections() })
Function highlightWorker
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function highlightWorker(e) {
var t = e.doc
if (!(t.highlightFrontier >= e.display.viewTo)) {
var n = +new Date() + e.options.workTime,
r = getContextBefore(e, t.highlightFrontier),
Function poll
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
(Ve.prototype.poll = function() {
var e = this,
t = this.cm,
n = this.textarea,
r = this.prevInput
Function tokenBase
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tokenBase(e, t) {
var n = e.next()
if ('"' == n || "'" == n)
return (t.tokenize = tokenString(n)), t.tokenize(e, t)
if ("." == n && e.match(/^\d+(?:[eE][+\-]?\d+)?/))
Function applyTextInput
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyTextInput(e, t, n, r, o) {
var i = e.doc
;(e.display.shift = !1), r || (r = i.sel)
var a = e.state.pasteIncoming || "paste" == o,
s = U(t),
Function updateDoc
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDoc(e, t, n, r) {
function spansFor(e) {
return n ? n[e] : null
}
function update(e, n, o) {
Consider simplifying this complex logical expression. Open
if (
!((u >= 0 && d <= 0) || (u <= 0 && d >= 0)) &&
((u <= 0 &&
(l.marker.inclusiveRight && o.inclusiveLeft
? cmp(c.to, n) >= 0
Function onScrollWheel
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onScrollWheel(e, t) {
var r = wheelEventDelta(t),
o = r.x,
i = r.y,
a = e.display,
Function highlightLine
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function highlightLine(e, t, n, r) {
var o = [e.state.modeGen],
i = {}
runMode(
e,
Function fromTextArea
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
(CodeMirror$1.fromTextArea = function fromTextArea(e, t) {
function save() {
e.value = a.getValue()
}
if (
Function makeChangeSingleDocInEditor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeChangeSingleDocInEditor(e, t, n) {
var r = e.doc,
o = e.display,
i = t.from,
a = t.to,
Function xmlToken
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xmlToken(n, i, a) {
if (2 == a.depth)
return (
n.match(/^.*?\*\//) ? (a.depth = 1) : n.skipToEnd(), "comment"
)
Function indentLine
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function indentLine(e, t, n, r) {
var o,
i = e.doc
null == n && (n = "add"),
"smart" == n &&
Function regChange
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function regChange(e, t, n, r) {
null == t && (t = e.doc.first),
null == n && (n = e.doc.first + e.doc.size),
r || (r = 0)
var o = e.display
Function locateNodeInLineView
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function locateNodeInLineView(e, t, n) {
function find(t, n, r) {
for (var o = -1; o < (c ? c.length : 0); o++)
for (var i = o < 0 ? l.map : c[o], a = 0; a < i.length; a += 3) {
var s = i[a + 2]
Function findPosH
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findPosH(e, t, n, r, o) {
function findNextLine() {
var r = t.line + n
return (
!(r < e.first || r >= e.first + e.size) &&
Similar blocks of code found in 2 locations. Consider refactoring. Open
r.right && r.bottom
? ((n.scrollbarFiller.style.display = "block"),
(n.scrollbarFiller.style.height = r.bottom + "px"),
(n.scrollbarFiller.style.width = r.right + "px"))
: (n.scrollbarFiller.style.display = ""),
- 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 70.
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