ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 98 of 1,256 total issues

Avoid deeply nested control flow statements.
Open

                if tour_stop["payload"]["mp4"].present? && tour_stop["payload"]["mp4"]["uri"].present?
                  mp4 = set_defaults_and_types(tour_stop["payload"]["mp4"])
                  mp4["id"] = "-3"

                  scene_downloadable_uris.unshift(mp4)
Severity: Major
Found in app/controllers/tours_controller.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        next if downloadable_uri.blank?
    Severity: Major
    Found in app/controllers/tours_controller.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if tour_stop["payload"]["quad"].present?
                        quad = set_defaults_and_types(tour_stop["payload"]["quad"])
                        quad["id"] = "-6"
                        quad["height"] = 1000
                        quad["width"] = 1000
      Severity: Major
      Found in app/controllers/tours_controller.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if tour_stop["payload"]["target"].present? && tour_stop["payload"]["target"]["uri"].present?
                          target = set_defaults_and_types(tour_stop["payload"]["target"])
                          target["id"] = "-1"
        
                          scene_downloadable_uris.unshift(target)
        Severity: Major
        Found in app/controllers/tours_controller.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if tour_stop["payload"]["image"].present? && tour_stop["payload"]["image"]["uri"].present?
                            image = set_defaults_and_types(tour_stop["payload"]["image"])
                            image["id"] = "-4"
          
                            scene_downloadable_uris.unshift(image)
          Severity: Major
          Found in app/controllers/tours_controller.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if tour_stop["payload"]["spot"].present?
                              spot = tour_stop["payload"]["spot"]
                              spot["id"] = "-7"
                              spot["shadow_opacity"] = spot["shadow_opacity"].presence || 0.6
                              spot["inner_angle"] = spot["inner_angle"].presence || 5
            Severity: Major
            Found in app/controllers/tours_controller.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if tour_stop["payload"]["start_date"].present? && tour_stop["payload"]["time_period_in_days"].present?
                                scene = scenes.first
                              end
              Severity: Major
              Found in app/controllers/tours_controller.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if tour_stop["payload"]["light"].present?
                                  light = set_defaults_and_types(tour_stop["payload"]["light"])
                                  light["id"] = "-5"
                
                                  scene_downloadable_uris.unshift(light)
                Severity: Major
                Found in app/controllers/tours_controller.rb - About 45 mins to fix

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

                  var getInitialValue = function (formObject, key, arrayPath, tpldata, usePreviousValues) {
                  Severity: Minor
                  Found in lib/jsonform.js - About 35 mins to fix

                    Method send_single_pick_up_time has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def send_single_pick_up_time(date, waste_type, street, zip, city)
                    Severity: Minor
                    Found in app/services/importer/waste_calendar.rb - About 35 mins to fix

                      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def initialize(uri, login = nil, password = nil, params = {}, headers = {})
                      Severity: Minor
                      Found in app/services/api_request_service.rb - About 35 mins to fix

                        Method build_mutation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def build_mutation(name, data, update = false, return_keys = "id", is_copy = false)
                        Severity: Minor
                        Found in app/services/converter/base.rb - About 35 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return !!_.some(formField.items, function (item) {
                                  return includeSchemaKey(item, schemaKey);
                                });
                          Severity: Major
                          Found in lib/jsonform-split.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              return false;
                            Severity: Major
                            Found in lib/jsonform.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return _.max(childNumbers) || 0;
                              Severity: Major
                              Found in lib/jsonform.js - About 30 mins to fix

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

                                    def nested_values?(value_to_check, result = [])
                                      result << true if value_to_check.class == String && value_to_check.present?
                                
                                      if value_to_check.class == Array
                                        value_to_check.each do |value|
                                Severity: Minor
                                Found in app/controllers/surveys_controller.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

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

                                  def visibility_location_href(item, item_class)
                                    return "location.href = '/visibility/#{item_class}/#{item.id}/#{item.visible ? 'false' : 'true'}/#{item.survey_poll_id}';" if item_class === "Survey_Comment"
                                
                                    "location.href = '/visibility/#{item_class}/#{item.id}/#{item.visible ? 'false' : 'true'}';"
                                  end
                                Severity: Minor
                                Found in app/helpers/application_helper.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

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

                                    def nested_values?(value_to_check, result = [])
                                      result << true if value_to_check.class == String && value_to_check.present?
                                
                                      if value_to_check.class == Array
                                        value_to_check.each do |value|
                                Severity: Minor
                                Found in app/controllers/application_controller.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