Showing 219 of 219 total issues
Function CodeMirror
has a Cognitive Complexity of 2984 (exceeds 5 allowed). Consider refactoring. Open
window.CodeMirror = (function() {
"use strict";
// BROWSER SNIFFING
- 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 CodeMirror
has 3916 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.CodeMirror = (function() {
"use strict";
// BROWSER SNIFFING
File codemirror.js
has 3919 lines of code (exceeds 250 allowed). Consider refactoring. Open
// CodeMirror version 3.01
//
// CodeMirror is the only global var we claim
window.CodeMirror = (function() {
"use strict";
Function Tabs
has a Cognitive Complexity of 275 (exceeds 5 allowed). Consider refactoring. Open
var Tabs = RightJS.Tabs = (function(document, parseInt, RightJS) {
/**
* This module defines the basic widgets constructor
* it creates an abstract proxy with the common functionality
* which then we reuse and override in the actual widgets
- 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 Tabs
has 638 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Tabs = RightJS.Tabs = (function(document, parseInt, RightJS) {
/**
* This module defines the basic widgets constructor
* it creates an abstract proxy with the common functionality
* which then we reuse and override in the actual widgets
Function multiplexingMode
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
CodeMirror.multiplexingMode = function(outer /*, others */) {
// Others should be {open, close, mode [, delimStyle]} objects
var others = Array.prototype.slice.call(arguments, 1);
var n_others = others.length;
- 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
File right-tabs-src.js
has 640 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Tabs widget for RightJS (http://rightjs.org/ui/tabs)
*
* Copyright (C) 2009-2010 Nikolay Nemshilov
*/
File css.js
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
CodeMirror.defineMode("css", function(config) {
var indentUnit = config.indentUnit, type;
var atMediaTypes = keySet([
"all", "aural", "braille", "handheld", "print", "projection", "screen",
File javascript.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
// TODO actually recognize syntax of TypeScript constructs
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var jsonMode = parserConfig.json;
Function onMouseDown
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onMouseDown(e) {
var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
sel.shift = e_prop(e, "shiftKey");
if (eventInWidget(display, e)) {
Function updateDocNoUndo
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
var view = cm.view, doc = view.doc, display = cm.display;
if (view.suppressEdits) return;
var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
Class Page
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class PufferPages::Backends::Page < ActiveRecord::Base
include ActiveUUID::UUID
include PufferPages::Backends::Mixins::Renderable
include PufferPages::Backends::Mixins::Importable
include PufferPages::Backends::Mixins::Localable
Function bidiOrdering
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
var bidiOrdering = (function() {
// Character types for codepoints 0 to 0xff
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";
// Character types for codepoints 0x600 to 0x6ff
var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
Function token
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
token: function(stream, state) {
// Use these terms when applicable (see http://www.xanthir.com/blog/b4E50)
//
// rule** or **ruleset:
Function multiplexingMode
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
CodeMirror.multiplexingMode = function(outer /*, others */) {
// Others should be {open, close, mode [, delimStyle]} objects
var others = Array.prototype.slice.call(arguments, 1);
var n_others = others.length;
File xml.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
Similar blocks of code found in 2 locations. Consider refactoring. Open
CodeMirror.defineMode("text/x-liquid-html", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "text/html"),
{
open: "{{", close: "}}",
- 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 100.
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
CodeMirror.defineMode("text/x-liquid-yaml", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "text/x-yaml"),
{
open: "{{", close: "}}",
- 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 100.
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 updateDisplayInner
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDisplayInner(cm, changes, viewPort) {
var display = cm.display, doc = cm.view.doc;
if (!display.wrapper.clientWidth) {
display.showingFrom = display.showingTo = display.viewOffset = 0;
return;
Function charOrdering
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function charOrdering(str) {
if (!bidiRE.test(str)) return false;
var len = str.length, types = [];
for (var i = 0, type; i < len; ++i)
types.push(type = charType(str.charCodeAt(i)));