Showing 214 of 347 total issues
Function limitBy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function limitBy(input, limit, begin) {
var type = avalon.type(input)
if (type !== 'array' && type !== 'object')
throw 'limitBy只能处理对象或数组'
//必须是数值
- 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 showHidden
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function showHidden(node, array) {
//http://www.cnblogs.com/rubylouvre/archive/2012/10/27/2742529.html
if (node.offsetWidth <= 0) { //opera.offsetWidth可能小于0
if (rdisplayswap.test(cssHooks['@:get'](node, 'display'))) {
var obj = {
- 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 equalObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function equalObject(a, b, level) {
if (a === null || b === null)
return false;
if (getEnumerableKeys(a).length !== getEnumerableKeys(b).length)
return false;
- 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 self
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
'select:get': function self(node, ret, index, singleton) {
var nodes = node.children, value,
index = ret ? index : node.selectedIndex
singleton = ret ? singleton : node.type === 'select-one' || index < 0
ret = ret || []
Function update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function (vdom, change, opts) {
var dom = vdom.dom
if (dom && dom.nodeType === 1) {
//要求配置对象必须指定is属性,action必须是布尔或enter,leave,move
var option = change || opts
Function bootstrap
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bootstrap() {
function doScrollCheck() {
try { //IE下通过doScrollCheck检测DOM树是否建完
root.doScroll('left')
fireReady()
Function compaceQuote
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export var compaceQuote = (function() {
//https://github.com/bestiejs/json3/blob/master/lib/json3.js
var Escapes = {
92: "\\\\",
34: '\\"',
Function makeOrphan
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function makeOrphan(node, nodeName, innerHTML) {
switch (nodeName) {
case 'style':
case 'script':
case 'noscript':
Function validateAll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
validateAll: function(callback) {
var validator = this
var vdom = this.vdom
var fields = validator.fields = []
collectFeild(vdom.children, fields, validator)
Function FragmentDecorator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FragmentDecorator(fragment, instance, index) {
var data = {}
data[instance.keyName] = instance.isArray ? index : fragment.key
data[instance.valName] = fragment.val
if (instance.asName) {
Function touchstart
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
touchstart: function(event) {
//忽略多点触摸
if (event.targetTouches.length !== 1) {
return true
}
Function newUpdate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function newUpdate() {
var oldVal = this.beforeUpdate()
var newVal = this.value = this.get()
if (this.callback && this.diff(newVal, oldVal)) {
this.callback(this.node, this.value)
Function css
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
avalon.css = function (node, name, value, fn) {
//读写删除元素节点的样式
if (node instanceof avalon) {
node = node[0]
}
Function slice
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ap.slice = function(begin, end) {
// IE < 9 gets unhappy with an undefined end argument
end = (typeof end !== 'undefined') ? end : this.length
// For native Array objects, we use the native slice function
Function offset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
avalon.fn.offset = function () { //取得距离页面左右角的坐标
var node = this[0],
box = {
left: 0,
top: 0
Function position
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
avalon.fn.position = function () {
var offsetParent, offset,
elem = this[0],
parentOffset = {
top: 0,
Function getCaret
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getCaret(target) {
var start = 0
var normalizedValue
var range
var textInputRange
Function getScale
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
getScale: function(x1, y1, x2, y2, x3, y3, x4, y4) {
Function collectHandlers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function collectHandlers(elem, type, handlers) {
var value = elem.getAttribute('avalon-events')
if (value && (elem.disabled !== true || type !== 'click')) {
var uuids = []
var reg = typeRegExp[type] || (typeRegExp[type] = new RegExp("\\b" + type + '\\:([^,\\s]+)', 'g'))
- 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 markProps
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function markProps(node, attrs) {
var ret = {}
for (var i = 0, n = attrs.length; i < n; i++) {
var attr = attrs[i]
if (attr.specified) {
- 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"