Showing 289 of 289 total issues
Function calculateScrollPos
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculateScrollPos(e, t) {
var n = e.display,
r = textHeight(e.display)
t.top < 0 && (t.top = 0)
var o =
Function domTextBetween
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function domTextBetween(e, t, n, r, o) {
function recognizeMarker(e) {
return function(t) {
return t.id == e
}
Function onCopyCut
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onCopyCut(e) {
if (!signalDOMEvent(r, e)) {
if (r.somethingSelected())
setLastCopied({ lineWise: !1, text: r.getSelections() }),
"cut" == e.type && r.replaceSelection("", null, "cut")
Identical blocks of code found in 2 locations. Consider refactoring. Open
componentWillUnmount() {
if (!_.isUndefined(this.state.hidingTimoutId)) {
clearTimeout(this.state.hidingTimoutId)
}
this.setState = _.noop
- 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 63.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
componentWillUnmount() {
if (!_.isUndefined(this.state.hidingTimoutId)) {
clearTimeout(this.state.hidingTimoutId)
}
this.setState = _.noop
- 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 63.
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 transposeChars
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
transposeChars: function(e) {
return runInOp(e, function() {
for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++)
if (t[r].empty()) {
var o = t[r].head,
Function pollSelection
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
(_e.prototype.pollSelection = function() {
if (
null == this.readDOMTimeout &&
!this.gracePeriod &&
this.selectionChanged()
Consider simplifying this complex logical expression. Open
if (c && u) {
var h,
f = e.rangeCount && e.getRangeAt(0)
try {
h = w(c.node, c.offset, u.offset, u.node)
Consider simplifying this complex logical expression. Open
if (l != a.length) {
for (
o.lastOrigin = o.lastSelOrigin = null;
(r = a.pop()).ranges;
Consider simplifying this complex logical expression. Open
if (!(cmp(c.to, s.from) < 0 || cmp(c.from, s.to) > 0)) {
var u = [l, 1],
d = cmp(c.from, s.from),
p = cmp(c.to, s.to)
;(d < 0 || (!a.inclusiveLeft && !d)) &&
Consider simplifying this complex logical expression. Open
else if (!clickInGutter(t, e)) {
var r = posFromMouse(t, e),
o = e_button(e),
i = r ? clickRepeat(r, o) : "single"
window.focus(),
Consider simplifying this complex logical expression. Open
if (
(o = t.markedSpans[i]).marker.collapsed &&
!o.marker.widgetNode &&
o.from == n.to &&
(null == o.to || o.to != n.from) &&
Consider simplifying this complex logical expression. Open
else if (d.node && d.node.parentNode == i) {
for (; a != d.node; ) a = rm(a)
var p = o && null != t && t <= c && d.lineNumber
d.changes &&
(indexOf(d.changes, "gutter") > -1 && (p = !1),
Consider simplifying this complex logical expression. Open
if (p.test(n))
return (
(">" == n && t.lexical && ">" == t.lexical.type) ||
(e.eat("=")
? ("!" != n && "=" != n) || e.eat("=")
Consider simplifying this complex logical expression. Open
if (
null == i.to ||
(a.inclusiveRight ? i.to >= t : i.to > t) ||
(i.from == t &&
"bookmark" == a.type &&
Consider simplifying this complex logical expression. Open
if (
this.contextMenuPending ||
!t.state.focused ||
(K(n) && !r && !this.composing) ||
t.isReadOnly() ||
Consider simplifying this complex logical expression. Open
if (
null == i.from ||
(a.inclusiveLeft ? i.from <= t : i.from < t) ||
(i.from == t &&
"bookmark" == a.type &&
Consider simplifying this complex logical expression. Open
if (
(Object.keys(e.options || {}).forEach(function(n) {
return t.editor.setOption(n, e.options[n])
}),
this.props.editorDidConfigure &&
Function runMode
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runMode(e, t, n, r, o, i, a) {
var s = n.flattenSpans
null == s && (s = e.options.flattenSpans)
var l,
c = 0,
Function onMouseDown
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onMouseDown(e) {
var t = this,
n = t.display
if (
!(signalDOMEvent(t, e) || (n.activeTouch && n.input.supportsTouch()))