yahoo/scrollable

View on GitHub

Showing 45 of 45 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it("required props", function () {
      spyOn(console, 'error');
      TestUtils.renderIntoDocument(
        <ScrollItem serverStyles={true} />
      );
Severity: Major
Found in src/__tests__/scroll-item-test.js and 1 other location - About 7 hrs to fix
src/__tests__/scroller-test.js on lines 23..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 186.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it("required props", function () {
      spyOn(console, 'error');
      TestUtils.renderIntoDocument(
        <Scroller serverStyles={true} />
      );
Severity: Major
Found in src/__tests__/scroller-test.js and 1 other location - About 7 hrs to fix
src/__tests__/scroll-item-test.js on lines 22..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 186.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

              <Scroller className={'nested-scroll'} scrollingX={true} scrollingY={false} getContentSize={this.getContentSize}>
                <ScrollItem name="content" scrollHandler={horizontalHandler}>
                  { 'photos' === this.state.display &&
                    <PhotoList />
                  }
    Severity: Major
    Found in examples/nested/index.js and 1 other location - About 4 hrs to fix
    examples/nested/index.js on lines 52..61

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

              <Scroller className={'nested-scroll'} scrollingX={true} scrollingY={false} getContentSize={this.getContentSize}>
                <ScrollItem name="content" scrollHandler={horizontalHandler}>
                  { 'photos' === this.state.display &&
                    <PhotoList />
                  }
    Severity: Major
    Found in examples/nested/index.js and 1 other location - About 4 hrs to fix
    examples/nested/index.js on lines 39..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          var SuposedConsumer = React.createClass({
            getInitialState: function() {return {remove:false};},
            render: function() {
              return (
                <Scroller ref="wrapper">
    Severity: Major
    Found in src/__tests__/scroll-item-test.js and 1 other location - About 3 hrs to fix
    src/__tests__/scroll-item-test.js on lines 283..294

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 105.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          var SuposedConsumer = React.createClass({
            getInitialState: function() {return {remove:false};},
            render: function() {
              return (
                <Scroller ref="wrapper">
    Severity: Major
    Found in src/__tests__/scroll-item-test.js and 1 other location - About 3 hrs to fix
    src/__tests__/scroll-item-test.js on lines 254..265

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 105.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                  <div className="nested-native-inner">
                    <div className="nested-native-inner-scroll">
                      { 'photos' === this.state.display &&
                        <PhotoList />
                      }
        Severity: Major
        Found in examples/nested-native/index.js and 1 other location - About 2 hrs to fix
        examples/nested-native/index.js on lines 42..51

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 87.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                  <div className="nested-native-inner">
                    <div className="nested-native-inner-scroll">
                      { 'photos' === this.state.display &&
                        <PhotoList />
                      }
        Severity: Major
        Found in examples/nested-native/index.js and 1 other location - About 2 hrs to fix
        examples/nested-native/index.js on lines 29..38

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 87.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              if (typeof targetX !== 'number') {
                incrementX = 0;
                elementAtPositionX = true;
              } else if(posX === targetX) {
                elementAtPositionX = true;
        Severity: Major
        Found in test-helpers/scroll.js and 1 other location - About 2 hrs to fix
        test-helpers/scroll.js on lines 54..63

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 86.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              if (typeof targetY !== 'number') {
                incrementY = 0;
                elementAtPositionY = true;
              } else if(posY === targetY) {
                elementAtPositionY = true;
        Severity: Major
        Found in test-helpers/scroll.js and 1 other location - About 2 hrs to fix
        test-helpers/scroll.js on lines 64..73

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 86.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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
                    Severity
                    Category
                    Status
                    Source
                    Language