yahoo/scrollable

View on GitHub

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";

Severity: Minor
Found in src/__tests__/scroll-item-test.js - About 4 hrs to fix

    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";
    
    
    Severity: Minor
    Found in src/__tests__/scroller-test.js - About 3 hrs to fix

      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);
      
      
      Severity: Major
      Found in test-helpers/scroll.js - About 2 hrs to fix

        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();
            }
        Severity: Minor
        Found in src/scroller.js - About 2 hrs to fix

        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') {
        Severity: Minor
        Found in examples/main.js - About 2 hrs to fix

          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;
          Severity: Minor
          Found in test-helpers/scroll.js - About 1 hr to fix

            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();
                }
            Severity: Minor
            Found in src/scroller.js - About 1 hr to fix

              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) {
              Severity: Minor
              Found in examples/fancy-header/index.js - About 1 hr to fix

                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">
                
                
                Severity: Minor
                Found in examples/nested-native/index.js - About 1 hr to fix

                  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"}>
                  
                  
                  Severity: Minor
                  Found in examples/nested/index.js - About 1 hr to fix

                    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) {
                    
                    
                    Severity: Minor
                    Found in src/prefixed.js - About 1 hr to fix

                    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 {
                    Severity: Minor
                    Found in src/__tests__/rect-cache-test.js - About 1 hr to fix

                      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 = {};
                      Severity: Minor
                      Found in src/scroll-item.js - About 55 mins to fix

                      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
                      Severity: Minor
                      Found in examples/consumption/index.js - About 45 mins to fix

                      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';
                                  }
                      Severity: Major
                      Found in src/scroller.js - About 45 mins to fix

                        Function scrollHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                  scrollHandler: function(x, y, self, items, scroller) {
                        Severity: Minor
                        Found in src/__tests__/scroller-test.js - About 35 mins to fix

                          Function simpleHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function simpleHandler(x, y, currentScrollItem, listOfAllScrollItemsComponents, scrollerContainerComponent) {
                          Severity: Minor
                          Found in examples/minimal/index.js - About 35 mins to fix

                            Function consumptionBars has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function consumptionBars(x, y, self, items, scroller) {
                            Severity: Minor
                            Found in examples/consumption/index.js - About 35 mins to fix

                              Function handlePositionWhenShowingAllCategories has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function handlePositionWhenShowingAllCategories(x, y, self, items, scroller) {
                              Severity: Minor
                              Found in examples/reminders/index.js - About 35 mins to fix

                                Function contentHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function contentHandler(x, y, self, items, scroller) {
                                Severity: Minor
                                Found in examples/consumption/index.js - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language