Showing 236 of 328 total issues
Function parseSwitchStatement
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseSwitchStatement() {
var discriminant, cases, clause, oldInSwitch, defaultFound;
expectKeyword('switch');
Function relative
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
Function parseUnaryExpression
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseUnaryExpression() {
var token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
return parsePostfixExpression();
Function uint8ToBase64
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function uint8ToBase64 (uint8) {
var i,
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
output = "",
temp, length
Function createState
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createState(source, rootNode, transformOptions) {
return {
/**
* A tree representing the current local scope (and its lexical scope chain)
* Useful for tracking identifiers from parent scopes, etc.
Function scanOctalLiteral
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function scanOctalLiteral(prefix, start) {
var number, octal;
if (isOctalDigit(prefix)) {
octal = true;
Function byteLength
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Buffer.byteLength = function (str, encoding) {
var ret
str = str + ''
switch (encoding || 'utf8') {
case 'hex':
Function parseImportDeclaration
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseImportDeclaration() {
var specifiers, kind, src;
expectKeyword('import');
specifiers = [];
Function nextTick
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
Function isKeyword
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function isKeyword(id) {
if (strict && isStrictModeReservedWord(id)) {
return true;
}
Function SourceMapConsumer_eachMapping
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
Method example_from_schema
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def example_from_schema(schema, parent=nil)
if schema.nil?
return nil
end
- 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 _readUInt32
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _readUInt32 (buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
assert(offset !== undefined && offset !== null, 'missing offset')
assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
Function parseContinueStatement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseContinueStatement() {
var label = null, key;
expectKeyword('continue');
Function SourceMapConsumer_originalPositionFor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
Function parseBreakStatement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseBreakStatement() {
var label = null, key;
expectKeyword('break');
Function b64ToByteArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function b64ToByteArray (b64) {
var i, j, l, tmp, placeHolders, arr
if (b64.length % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
Function transform
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function transform(visitors, source, options) {
options = options || {};
var ast;
try {
Function read
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
Function parseParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseParams(firstRestricted) {
var options;
options = {
params: [],