Showing 69 of 104 total issues
Consider simplifying this complex logical expression. Open
if (typeof ElementProto.matches !== 'function') {
ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
var element = this;
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
var index = 0;
Consider simplifying this complex logical expression. Open
if url.is_a? Array
urls = url.map do |u|
page_url = clip_char(page_url.to_s.downcase, '/').split('/')[0]
u = clip_char(u.to_s.downcase, '/').split('/')[0]
# if the url group is 'blog', match date strings
Function 37
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
},{"./active-element":34,"./behavior":35,"./select":38,"object-assign":7,"receptor":13}],37:[function(require,module,exports){
"use strict";
// https://stackoverflow.com/a/7557433
function isElementInViewport(el) {
- 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 41
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
},{"./toggle-field-mask":39,"resolve-id-refs":16}],41:[function(require,module,exports){
"use strict";
var EXPANDED = "aria-expanded";
var CONTROLS = "aria-controls";
- 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 21
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
},{"../config":28,"../events":29,"../utils/behavior":35,"../utils/select":38,"receptor/keymap":14}],21:[function(require,module,exports){
"use strict";
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Method tag_freq
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def tag_freq(posts)
@tag_freq = Hash.new(0)
posts.docs.each do |post|
post.data['categories'].each { |category| @tag_freq[category] += 1 } if @use_categories
post.data['tags'].each { |tag| @tag_freq[tag] += 1 } if @use_tags
- 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
Method assume_uid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assume_uid
unless does_uid_exist(HOST_UID)
username = HOST_USER
username += '0' while does_username_exist(username)
home_dir = '/home/' + username
- 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"