Showing 39 of 93 total issues
File ember-template-compiler.js
has 5914 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
Function handlebars
has 501 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var handlebars = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"sexpr":18,"CLOSE_RAW_BLOCK":19,"openBlock":20,"block_option0":21,"closeBlock":22,"openInverse":23,"block_option1":24,"OPEN_BLOCK":25,"openBlock_option0":26,"CLOSE":27,"OPEN_INVERSE":28,"openInverse_option0":29,"openInverseChain":30,"OPEN_INVERSE_CHAIN":31,"openInverseChain_option0":32,"inverseAndProgram":33,"INVERSE":34,"inverseChain":35,"inverseChain_option0":36,"OPEN_ENDBLOCK":37,"path":38,"OPEN":39,"OPEN_UNESCAPED":40,"CLOSE_UNESCAPED":41,"OPEN_PARTIAL":42,"helperName":43,"sexpr_repetition0":44,"sexpr_option0":45,"dataName":46,"param":47,"STRING":48,"NUMBER":49,"BOOLEAN":50,"OPEN_SEXPR":51,"CLOSE_SEXPR":52,"hash":53,"hash_repetition_plus0":54,"hashSegment":55,"ID":56,"EQUALS":57,"blockParams":58,"OPEN_BLOCK_PARAMS":59,"blockParams_repetition_plus0":60,"CLOSE_BLOCK_PARAMS":61,"DATA":62,"pathSegments":63,"SEP":64,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",19:"CLOSE_RAW_BLOCK",25:"OPEN_BLOCK",27:"CLOSE",28:"OPEN_INVERSE",31:"OPEN_INVERSE_CHAIN",34:"INVERSE",37:"OPEN_ENDBLOCK",39:"OPEN",40:"OPEN_UNESCAPED",41:"CLOSE_UNESCAPED",42:"OPEN_PARTIAL",48:"STRING",49:"NUMBER",50:"BOOLEAN",51:"OPEN_SEXPR",52:"CLOSE_SEXPR",56:"ID",57:"EQUALS",59:"OPEN_BLOCK_PARAMS",61:"CLOSE_BLOCK_PARAMS",62:"DATA",64:"SEP"},
Function lexer
has 276 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var lexer = (function(){
var lexer = ({EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
Function anonymous
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
function strip(start, end) {
return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
Function anonymous
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1: return $$[$0-1];
Function parse
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parse: function parse(input) {
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
Function endProgram
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
TemplateCompiler.prototype.endProgram = function(program, programDepth) {
this.fragmentOpcodeCompiler.endProgram(program);
this.hydrationOpcodeCompiler.endProgram(program);
var indent = repeat(" ", programDepth);
Function next
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) this.done = true;
Function BlockStatement
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
WhitespaceControl.prototype.BlockStatement = function(block) {
this.accept(block.program);
this.accept(block.inverse);
// Find the inverse program that is involed with whitespace stripping.
Function Program
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
WhitespaceControl.prototype.Program = function(program) {
var isRoot = !this.isRootSeen;
this.isRootSeen = true;
var body = program.body;
Function MustacheStatement
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
MustacheStatement: function(mustache) {
var tokenizer = this.tokenizer;
switch(tokenizer.state) {
// Tag helpers
Function compile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prototype.compile = function(opcodes, options) {
this.stack.length = 0;
this.mustaches.length = 0;
this.source.length = 0;
this.parents.length = 1;
Function ElementNode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
TemplateVisitor.prototype.ElementNode = function(element) {
var parentFrame = this.getCurrentFrame();
var elementFrame = this.pushFrame();
var parentNode = parentFrame.parentNode;
Function parseComponentBlockParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseComponentBlockParams(element, program) {
var l = element.attributes.length;
var attrNames = [];
for (var i = 0; i < l; i++) {
Function sourceForMustache
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
HTMLProcessor.prototype.sourceForMustache = function(mustache) {
var firstLine = mustache.loc.start.line - 1;
var lastLine = mustache.loc.end.line - 1;
var currentLine = firstLine - 1;
var firstColumn = mustache.loc.start.column + 2;
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (options) {
options = options || {};
function HtmlBars (file, enc, cb) {
if (file.isNull()) {
- 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 BlockStatement
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
BlockStatement: function(sexpr, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
Function performAction
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
Avoid deeply nested control flow statements. Open
Open
if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
}
Function prepareBlock
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
__exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {