Showing 12 of 12 total issues

Function exports has 78 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

    Method form_field has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def form_field(attribute, options, &block)
        content_tag(:div, class: "field") do
          # Label
          label = label(attribute, options[:label])
    
    
    Severity: Minor
    Found in app/form_builders/formatted_form_builder.rb - 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

    Method file_field has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def file_field(attribute, options = {})
        form_field(attribute, options) do
          file_tag(attribute, options) do
            file_label_tag(attribute, options) do
              # Input for selecting the file
    Severity: Minor
    Found in app/form_builders/formatted_form_builder.rb - 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

    Method new_update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def new_update
        action = params[:update_action]
        order_session = parse_order_session(params[:session])
        product_ids = order_session[:product_ids]
    
    
    Severity: Minor
    Found in app/controllers/orders_controller.rb - 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 init has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      init() {
        // Initialize the barcode scanner
        Quagga.init(
          {
            // Video input stream
    Severity: Minor
    Found in app/javascript/packs/utils/scanner.js - About 1 hr to fix

      Method submit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def submit(value = nil, options = {})
          css_class = "is-flex"
      
          # If the "justify" option is provided, use it as the class.
          # If not provided, justify to the end.
      Severity: Minor
      Found in app/form_builders/formatted_form_builder.rb - 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

      Method create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          respond_to do |format|
            format.html do
              # Make sure the order is saved correctly
              if @order.save
      Severity: Minor
      Found in app/controllers/orders_controller.rb - 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

      Method new_update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def new_update
          action = params[:update_action]
          order_session = parse_order_session(params[:session])
          product_ids = order_session[:product_ids]
      
      
      Severity: Minor
      Found in app/controllers/orders_controller.rb - About 1 hr to fix

        Method form_field has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def form_field(attribute, options, &block)
            content_tag(:div, class: "field") do
              # Label
              label = label(attribute, options[:label])
        
        
        Severity: Minor
        Found in app/form_builders/formatted_form_builder.rb - About 1 hr to fix

          Method control_tag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def control_tag(_attribute, options = {})
              css_class = "control"
          
              # Add "has-icons-left" class if the option "prefix_icon" is provided.
              css_class += " has-icons-left" if options[:prefix_icon]
          Severity: Minor
          Found in app/form_builders/formatted_form_builder.rb - 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

          Method collection_select has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def collection_select(attribute, collection, value_method, text_method, options = {}, html_options = {})
          Severity: Minor
          Found in app/form_builders/formatted_form_builder.rb - About 45 mins to fix

            Method file_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def file_tag(attribute, options = {}, &block)
                css_class = "file"
            
                # Add "has-name" class if the skip_name option is false
                css_class += " has-name" unless options[:skip_name]
            Severity: Minor
            Found in app/form_builders/formatted_form_builder.rb - 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