my-grocery-price-book/www

View on GitHub

Showing 16 of 64 total issues

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

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

Severity: Major
Found in app/javascript/src/EntriesForm/components/entries_form.jsx - About 3 hrs to fix

    Function exports has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(api) {
      var validEnv = ['development', 'test', 'production']
      var currentEnv = api.env()
      var isDevelopmentEnv = api.env('development')
      var isProductionEnv = api.env('production')
    Severity: Major
    Found in babel.config.js - About 3 hrs to fix

      Function render has 70 lines of code (exceeds 25 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: Major
      Found in app/javascript/src/ShoppingList/components/shopping_list_item.jsx - About 2 hrs to fix

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

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

          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

                          Function displayPriceRatio has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            displayPriceRatio: function (p, unit) {
                              if (unit == 'grams' && p >= 1000) {
                                return (this.displayPrice(p / 1000) + ' / kilograms');
                              } else if (unit == 'kilograms' && p <= 0.01) {
                                return (this.displayPrice(p * 1000) + ' / grams');
                          Severity: Minor
                          Found in app/javascript/src/PriceBook/components/page.jsx - About 35 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 too many return statements within this function.
                          Open

                                return (this.displayPrice(p) + ' / ' + unit);
                          Severity: Major
                          Found in app/javascript/src/PriceBook/components/page.jsx - About 30 mins to fix

                            Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            module.exports = function(api) {
                              var validEnv = ['development', 'test', 'production']
                              var currentEnv = api.env()
                              var isDevelopmentEnv = api.env('development')
                              var isProductionEnv = api.env('production')
                            Severity: Minor
                            Found in babel.config.js - About 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language