Showing 27 of 45 total issues
File scroll-item-test.js
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
"use strict";
File scroller-test.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Copyright 2015, Yahoo Inc.
Copyrights licensed under the MIT License.
See the accompanying LICENSE file for terms. */
"use strict";
Function scrollElementIntoPosition
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function scrollElementIntoPosition(selector, targetX, targetY, callback) {
var errorPrefix = "Impossible to scrollElementIntoPosition: ";
var targetElement = document.querySelector(selector);
Function animateAndResetScroll
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
animateAndResetScroll: function(x, y, atomic) {
var self = this;
if (atomic) {
self._scroller.stopEvents();
}
- 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 render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var self = this;
var render = self.state.currentExample;
if (render === 'nav') {
Function goToElement
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function goToElement(callback) {
var goingX = currentX + incrementX;
var goingY = currentY + incrementY;
scrollTo(goingX, goingY);
currentY = scroller.scrollTop;
Function animateAndResetScroll
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
animateAndResetScroll: function(x, y, atomic) {
var self = this;
if (atomic) {
self._scroller.stopEvents();
}
Function handler
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handler(x, y, self, items, scroller) {
var transitionPixels = 100;
var ratio = 6;
var headerPos = Math.max(transitionPixels - y, 0) / ratio;
if (y < 0) {
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
return (
<div className="nested-native-viewport">
<div className="nested-native-viewport-scroll">
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
return (
<Scroller viewport scrollingX={false} scrollingY={true} getContentSize={this.getContentSize}>
<ScrollItem name="content" scrollHandler={verticalHandler} exampleProp={"for scroll calculation"}>
Function testDOMProps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function testDOMProps(props, obj, elem) {
for (var i in props) {
var item = obj[props[i]];
if (item !== undefined) {
- 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 createConstructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createConstructor() {
return React.createClass({
mixins: [RectCache],
getInitialState: function() {
return {
Function cleanupStyles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function cleanupStyles(item) {
var prop;
var reactProps;
if (item.props.style) {
reactProps = {};
- 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 consumptionBars
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function consumptionBars(x, y, self, items, scroller) {
// All calculations are made for top handler, then inverted in the end
// if this call refers to the bottom handler
// If we are in the middle of the content and scrolled past the swipe origin
- 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 deeply nested control flow statements. Open
if(prop in acumulate) {
acumulate[prop] = Math.max(acumulate[prop], transitionObject[prop]);
transitionObject[prop] = transitionObject[prop] + 'ms';
}
Function scrollHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
scrollHandler: function(x, y, self, items, scroller) {
Function simpleHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function simpleHandler(x, y, currentScrollItem, listOfAllScrollItemsComponents, scrollerContainerComponent) {
Function consumptionBars
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function consumptionBars(x, y, self, items, scroller) {
Function handlePositionWhenShowingAllCategories
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function handlePositionWhenShowingAllCategories(x, y, self, items, scroller) {
Function contentHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function contentHandler(x, y, self, items, scroller) {