Showing 289 of 289 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
r.bottom &&
e.options.coverGutterNextToScrollbar &&
e.options.fixedGutter
? ((n.gutterFiller.style.display = "block"),
(n.gutterFiller.style.height = r.bottom + "px"),
- 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
Function clear
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
;(xe.prototype.clear = function() {
var e = this
if (!this.explicitlyCleared) {
var t = this.doc.cm,
n = t && !t.curOp
Consider simplifying this complex logical expression. Open
if (
!a ||
a.bad ||
!s ||
s.bad ||
Consider simplifying this complex logical expression. Open
if (o && !n && !d && null != ge)
return (
i && u && updateScrollTop(e, Math.max(0, s.scrollTop + i * ge)),
setScrollLeft(e, Math.max(0, s.scrollLeft + o * ge)),
(!i || (i && u)) && e_preventDefault(t),
Consider simplifying this complex logical expression. Open
if (
((e.trailingSpace = 32 == u.charCodeAt(t.length - 1)),
n || r || o || p || l)
) {
var x = n || ""
Consider simplifying this complex logical expression. Open
if (
((t.contextMenuPending = !1),
(t.wrapper.style.cssText = p),
(o.style.cssText = u),
a &&
Function patchDisplay
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function patchDisplay(e, t, n) {
function rm(t) {
var n = t.nextSibling
return (
l && y && e.display.currentWheelTarget == t
Function stretchSpansOverChange
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stretchSpansOverChange(e, t) {
if (t.full) return null
var n = isLine(e, t.from.line) && getLine(e, t.from.line).markedSpans,
r = isLine(e, t.to.line) && getLine(e, t.to.line).markedSpans
if (!n && !r) return null
Function expressionInner
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function expressionInner(e, t) {
if (m.state.fatArrowAt == m.stream.start) {
var n = t ? arrowBodyNoComma : arrowBody
if ("(" == e)
return cont(
Function addLegacyProps
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function addLegacyProps(e) {
;(e.off = off),
(e.on = V),
(e.wheelEventPixels = wheelEventPixels),
(e.Doc = Se),
Function postUpdateDisplay
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function postUpdateDisplay(e, t) {
for (
var n = t.viewport, r = !0;
((r &&
e.options.lineWrapping &&
Function leftButtonStartDrag
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function leftButtonStartDrag(e, t, n, r) {
var o = e.display,
i = !1,
c = operation(e, function(t) {
l && (o.scroller.draggable = !1),
Function skipAtomicInner
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function skipAtomicInner(e, t, n, r, o) {
var i = getLine(e, t.line)
if (i.markedSpans)
for (var a = 0; a < i.markedSpans.length; ++a) {
var s = i.markedSpans[a],
Function extendTo
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extendTo(t) {
if (0 != cmp(d, t))
if (((d = t), "rectangle" == r.unit)) {
for (
var o = [],
Function indent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
indent: function(t, r) {
if (t.tokenize == tokenComment) return e.Pass
if (t.tokenize != tokenBase) return 0
var o,
s = r && r.charAt(0),
Function m
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
m = (function(e) {
function Editor() {
_classCallCheck(this, Editor)
var e = _possibleConstructorReturn(
this,
Function scrollPosIntoView
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function scrollPosIntoView(e, t, n, r) {
null == r && (r = 0)
var o
e.options.lineWrapping ||
t != n ||
Function addChangeToHistory
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addChangeToHistory(e, t, n, r) {
var o = e.history
o.undone.length = 0
var i,
a,
Function nodeAndOffsetInLineMap
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function nodeAndOffsetInLineMap(e, t, n) {
for (var r, o, i, a, s, l, c = 0; c < e.length; c += 3)
if (
((s = e[c]),
(l = e[c + 1]),
Function addWidget
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
addWidget: function(e, t, n, r, o) {
var i = this.display,
a = (e = cursorCoords(this, clipPos(this.doc, e))).bottom,
s = e.left
if (