File erlang.js
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
/*jshint unused:true, eqnull:true, curly:true, bitwise:true */
/*jshint undef:true, latedef:true, trailing:true */
Function tokenizer
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tokenizer(stream,state) {
// in multi-line string
if (state.in_string) {
state.in_string = (!doubleQuote(stream));
return rval(state,stream,"string");
Function indenter
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function indenter(state,textAfter) {
var t;
var unit = cmCfg.indentUnit;
var wordAfter = wordafter(textAfter);
var currT = peekToken(state,1);
Function rval
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function rval(state,stream,type) {
// parse stack
pushToken(state,realToken(type,stream));
Avoid deeply nested control flow statements. Open
if (stream.eat(/[eE]/)) { // float with exponent
if (stream.eat(/[-+]/)) {
if (!stream.eatWhile(digitRE)) {
stream.backUp(2); // "2e-" - syntax error
}
Avoid too many return
statements within this function. Open
return rval(state,stream,"dot");
Avoid too many return
statements within this function. Open
return currT.column+3;
Avoid too many return
statements within this function. Open
return rval(state,stream,"operator");
Avoid too many return
statements within this function. Open
return rval(state,stream,"function");
Avoid too many return
statements within this function. Open
return rval(state,stream,"boolean");
Avoid too many return
statements within this function. Open
return t.column;
Avoid too many return
statements within this function. Open
return rval(state,stream,"colon");
Avoid too many return
statements within this function. Open
return rval(state,stream,"open_paren");
Avoid too many return
statements within this function. Open
return rval(state,stream,"number");
Avoid too many return
statements within this function. Open
return rval(state,stream,"fun"); // 'f'/0 style fun
Avoid too many return
statements within this function. Open
return rval(state,stream,"fun"); // f/0 style fun
Avoid too many return
statements within this function. Open
return truthy(t) ? t.column+unit : 0;
Avoid too many return
statements within this function. Open
return rval(state,stream,"error");
Avoid too many return
statements within this function. Open
return rval(state,stream,"separator");
Avoid too many return
statements within this function. Open
return rval(state,stream,"comment");
Avoid too many return
statements within this function. Open
return t ? t.column+t.token.length : unit;
Avoid too many return
statements within this function. Open
return rval(state,stream,"builtin");
Avoid too many return
statements within this function. Open
return rval(state,stream,"boolean");
Avoid too many return
statements within this function. Open
return rval(state,stream,"atom");
Avoid too many return
statements within this function. Open
return rval(state,stream,"attribute");
Avoid too many return
statements within this function. Open
return rval(state,stream,"operator");
Avoid too many return
statements within this function. Open
return prevT.column+unit+unit;
Avoid too many return
statements within this function. Open
return rval(state,stream,"function");
Avoid too many return
statements within this function. Open
return rval(state,stream,"string");
Avoid too many return
statements within this function. Open
return rval(state,stream,"close_paren");
Avoid too many return
statements within this function. Open
return rval(state,stream,"variable");
Avoid too many return
statements within this function. Open
return rval(state,stream,"builtin");
Avoid too many return
statements within this function. Open
return t ? t.column : CodeMirror.Pass;
Avoid too many return
statements within this function. Open
return prevT.column+unit;
Avoid too many return
statements within this function. Open
return rval(state,stream,"macro");
Avoid too many return
statements within this function. Open
return rval(state,stream,"record");
Avoid too many return
statements within this function. Open
return rval(state,stream,"guard");
Avoid too many return
statements within this function. Open
return rval(state,stream,"operator");
Avoid too many return
statements within this function. Open
return currT.column+currT.token.length;
Avoid too many return
statements within this function. Open
return rval(state,stream,"atom");
Avoid too many return
statements within this function. Open
return rval(state,stream,"keyword");
Avoid too many return
statements within this function. Open
return rval(state,stream,"function");
Avoid too many return
statements within this function. Open
return rval(state,stream,"number"); // normal integer
Avoid too many return
statements within this function. Open
return rval(state,stream,null);
Avoid too many return
statements within this function. Open
return t ? t.column : CodeMirror.Pass;
Similar blocks of code found in 71 locations. Consider refactoring. Open
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
- 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 82.
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
if (ch == '?') {
stream.eatSpace();
stream.eatWhile(anumRE);
return rval(state,stream,"macro");
}
- 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 45.
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
if (ch == "#") {
stream.eatSpace();
stream.eatWhile(anumRE);
return rval(state,stream,"record");
}
- 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 45.
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