Function lexer
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
function lexer(string, getOne) {
var tokens = []
var breakIndex = 9990
var stack = []
var origString = string
- 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 getAttrs
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
function getAttrs(string) {
var state = 'AttrName',
attrName = '',
attrValue = '',
quote,
- 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 fromString.js
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* ------------------------------------------------------------
* avalon2.2.6的新式lexer
* 将字符串变成一个虚拟DOM树,方便以后进一步变成模板函数
* 此阶段只会生成VElement,VText,VComment
Function getOpenTag
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function getOpenTag(string) {
if (string.indexOf("<") === 0) {
var i = string.indexOf('<!--') //处理注释节点
if (i === 0) {
var l = string.indexOf('-->')
- 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 lexer
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lexer(string, getOne) {
var tokens = []
var breakIndex = 9990
var stack = []
var origString = string
Function parseTextDir
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function parseTextDir(string) {
var closeTag = config.closeTag
var openTag = config.openTag
var closeTagFirst = closeTag.charAt(0)
var closeTagLength = closeTag.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
Function getAttrs
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAttrs(string) {
var state = 'AttrName',
attrName = '',
attrValue = '',
quote,
Function getOpenTag
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getOpenTag(string) {
if (string.indexOf("<") === 0) {
var i = string.indexOf('<!--') //处理注释节点
if (i === 0) {
var l = string.indexOf('-->')
Function insertTbody
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function insertTbody(nodes) {
var tbody = false
for (var i = 0, n = nodes.length; i < n; i++) {
var node = nodes[i]
if (rtbody.test(node.nodeName)) {
- 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 parseTextDir
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseTextDir(string) {
var closeTag = config.closeTag
var openTag = config.openTag
var closeTagFirst = closeTag.charAt(0)
var closeTagLength = closeTag.length
Function insertTbody
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertTbody(nodes) {
var tbody = false
for (var i = 0, n = nodes.length; i < n; i++) {
var node = nodes[i]
if (rtbody.test(node.nodeName)) {
Avoid deeply nested control flow statements. Open
if (!attrName) {
throw '必须指定属性名'
}
Parsing error: 'import' and 'export' may appear only with 'sourceType: module' Open
import { avalon, Cache, config } from '../seed/core'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/