my-grocery-price-book/www

View on GitHub

Showing 64 of 64 total issues

Function render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render: function () {
    var props = this.props;
    var state = this.state;

    return (
Severity: Minor
Found in app/javascript/src/ShoppingListsIndex/components/shopping_list.jsx - About 1 hr to fix

    Function render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render: function () {
        var state = this.state;
        var props = this.props;
        var component = this;
    
    

      Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render: function () {
          var props = this.props;
          var state = this.state;
      
          var rendered_pages = state.pages.map(function (page) {
      Severity: Minor
      Found in app/javascript/src/PriceBook/components/book.jsx - About 1 hr to fix

        Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render: function () {
            var props = this.props;
            var state = this.state;
        
            if(props.show_form) {

          Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render: function () {
              var props = this.props;
              var state = this.state;
          
              if(props.show_form) {
          Severity: Minor
          Found in app/javascript/src/ShoppingList/components/shopping_list_title.jsx - About 1 hr to fix

            Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render: function () {
                var vm = this;
            
                var render_lists = this.state.lists.map(function (list) {
                  return (

              Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render: function () {
                  var page = this.props.page;
              
                  var info = <div className="page-info">
                    { page.category },{ page.unit }
              Severity: Minor
              Found in app/javascript/src/PriceBook/components/page.jsx - About 1 hr to fix

                Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render: function () {
                    return (
                        <div className={this.props.div_class}
                             id={this.props.modal_id}
                             tabIndex="-1"
                Severity: Minor
                Found in app/javascript/src/lib/confirm_delete.jsx - About 1 hr to fix

                  Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render: function () {
                      var props = this.props;
                      var page = this.props.page;
                      var state = this.state;
                      var category_class = 'category-' + this.dasherize(page.category);
                  Severity: Minor
                  Found in app/javascript/src/ShoppingList/components/shopping_list_item.jsx - 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

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

                    handleProductNameChange: function (e) {
                      this.findSuggestions(e.target.value);
                      this.setState({product_name: e.target.value});
                    },
                  Severity: Major
                  Found in app/javascript/src/EntriesForm/components/entries_form.jsx and 1 other location - About 1 hr to fix
                  app/javascript/src/ShoppingList/components/shopping_list_item_add_form.jsx on lines 25..28

                  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 55.

                  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

                    handleNameChange: function (e) {
                      this.findSuggestions(e.target.value);
                      this.setState({name: e.target.value});
                    },
                  app/javascript/src/EntriesForm/components/entries_form.jsx on lines 48..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 55.

                  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

                    findSuggestions: function (name) {
                      if (this.state.bloodhound_initialized) {
                        this.bloodhound.search(name,
                          this.handleNameSuggestions,
                          this.handleAdditionalNameSuggestions)
                  app/javascript/src/EntriesForm/components/entries_form.jsx on lines 53..59

                  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 51.

                  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 5 locations. Consider refactoring.
                  Open

                    it("sets initial amount", function () {
                      const input = dom_node.find('#amount');
                  
                      expect(input.attr('value')).toEqual("10");
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/entries_form.spec.jsx and 4 other locations - About 50 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 33..37
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 39..43
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 45..49
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 51..55

                  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 51.

                  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 5 locations. Consider refactoring.
                  Open

                    it("sets initial package_size", function () {
                      const input = dom_node.find('#package_size');
                  
                      expect(input.attr('value')).toEqual("20");
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/entries_form.spec.jsx and 4 other locations - About 50 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 39..43
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 45..49
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 51..55
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 57..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 51.

                  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

                    findSuggestions: function (name) {
                      if (this.state.bloodhound_initialized) {
                        this.bloodhound.search(name,
                          this.handleNameSuggestions,
                          this.handleAdditionalNameSuggestions)
                  Severity: Minor
                  Found in app/javascript/src/EntriesForm/components/entries_form.jsx and 1 other location - About 50 mins to fix
                  app/javascript/src/ShoppingList/components/shopping_list_item_add_form.jsx on lines 30..36

                  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 51.

                  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 5 locations. Consider refactoring.
                  Open

                    it("sets initial product_name", function () {
                      const input = dom_node.find('#product_name');
                  
                      expect(input.attr('value')).toEqual("Beans");
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/entries_form.spec.jsx and 4 other locations - About 50 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 33..37
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 39..43
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 45..49
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 57..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 51.

                  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 5 locations. Consider refactoring.
                  Open

                    it("sets initial total_price", function () {
                      const input = dom_node.find('#total_price');
                  
                      expect(input.attr('value')).toEqual("100");
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/entries_form.spec.jsx and 4 other locations - About 50 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 33..37
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 45..49
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 51..55
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 57..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 51.

                  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 5 locations. Consider refactoring.
                  Open

                    it("sets initial date_on", function () {
                      const input = dom_node.find('#date_on');
                  
                      expect(input.attr('value')).toEqual("2016-01-21");
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/entries_form.spec.jsx and 4 other locations - About 50 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 33..37
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 39..43
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 51..55
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 57..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 51.

                  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 9 locations. Consider refactoring.
                  Open

                    it("shows item name", function () {
                      const div_item = react_dom.find('[data-name]');
                  
                      expect(div_item.text()).toContain('Brown Bread');
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/shopping_list_item.spec.jsx and 8 other locations - About 45 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 63..67
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 69..73
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 75..79
                  app/javascript/__test__/components/page.spec.jsx on lines 15..18
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 25..29
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 37..41
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 43..47
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 49..53

                  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 50.

                  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 9 locations. Consider refactoring.
                  Open

                    it("shows comparing price", function () {
                      const div_item = react_dom.find('[data-comparing-price]');
                  
                      expect(div_item.text()).toContain('$13.95');
                    });
                  Severity: Major
                  Found in app/javascript/__test__/components/shopping_list_item.spec.jsx and 8 other locations - About 45 mins to fix
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 63..67
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 69..73
                  app/javascript/__test__/components/entries_form.spec.jsx on lines 75..79
                  app/javascript/__test__/components/page.spec.jsx on lines 15..18
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 25..29
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 31..35
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 37..41
                  app/javascript/__test__/components/shopping_list_item.spec.jsx on lines 43..47

                  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 50.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language