ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 1,158 of 1,254 total issues

Function hasRequiredField has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

formTree.prototype.hasRequiredField = function () {
  var parseElement = function (element) {
    if (!element) return null;
    if (element.required && (element.type !== 'boolean')) {
      return element;
Severity: Minor
Found in lib/jsonform.js - About 1 hr to fix

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

          if @event_params["media_contents"].present?
            media_contents = []
            @event_params["media_contents"].each do |_key, media_content|
              next if media_content.blank?
              # content_type is always something (default: `image`), so we need to check all values
    Severity: Major
    Found in app/controllers/events_controller.rb and 4 other locations - About 1 hr to fix
    app/controllers/constructions_controller.rb on lines 189..200
    app/controllers/deadlines_controller.rb on lines 223..234
    app/controllers/jobs_controller.rb on lines 236..247
    app/controllers/offers_controller.rb on lines 208..219

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

    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

          if @offer_params["media_contents"].present?
            media_contents = []
            @offer_params["media_contents"].each do |_key, media_content|
              next if media_content.blank?
              # content_type is always something (default: `image`), so we need to check all values
    Severity: Major
    Found in app/controllers/offers_controller.rb and 4 other locations - About 1 hr to fix
    app/controllers/constructions_controller.rb on lines 189..200
    app/controllers/deadlines_controller.rb on lines 223..234
    app/controllers/events_controller.rb on lines 371..382
    app/controllers/jobs_controller.rb on lines 236..247

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

    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

          if @construction_params["media_contents"].present?
            media_contents = []
            @construction_params["media_contents"].each do |_key, media_content|
              next if media_content.blank?
              # content_type is always something (default: `image`), so we need to check all values
    Severity: Major
    Found in app/controllers/constructions_controller.rb and 4 other locations - About 1 hr to fix
    app/controllers/deadlines_controller.rb on lines 223..234
    app/controllers/events_controller.rb on lines 371..382
    app/controllers/jobs_controller.rb on lines 236..247
    app/controllers/offers_controller.rb on lines 208..219

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

    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

          if @job_params["media_contents"].present?
            media_contents = []
            @job_params["media_contents"].each do |_key, media_content|
              next if media_content.blank?
              # content_type is always something (default: `image`), so we need to check all values
    Severity: Major
    Found in app/controllers/jobs_controller.rb and 4 other locations - About 1 hr to fix
    app/controllers/constructions_controller.rb on lines 189..200
    app/controllers/deadlines_controller.rb on lines 223..234
    app/controllers/events_controller.rb on lines 371..382
    app/controllers/offers_controller.rb on lines 208..219

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

    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

          if @deadline_params["media_contents"].present?
            media_contents = []
            @deadline_params["media_contents"].each do |_key, media_content|
              next if media_content.blank?
              # content_type is always something (default: `image`), so we need to check all values
    Severity: Major
    Found in app/controllers/deadlines_controller.rb and 4 other locations - About 1 hr to fix
    app/controllers/constructions_controller.rb on lines 189..200
    app/controllers/events_controller.rb on lines 371..382
    app/controllers/jobs_controller.rb on lines 236..247
    app/controllers/offers_controller.rb on lines 208..219

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

    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

    Consider simplifying this complex logical expression.
    Open

      if (formElement.key) {
        // The form element is directly linked to an element in the JSON
        // schema. The properties of the form element override those of the
        // element in the JSON schema. Properties from the JSON schema complete
        // those of the form element otherwise.
    Severity: Major
    Found in lib/jsonform.js - About 1 hr to fix

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

            if (this.view.onChange)
              $(this.el).bind('change', function(evt) { node.view.onChange(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2751..2752
      lib/jsonform.js on lines 2756..2757
      lib/jsonform.js on lines 2758..2759
      lib/jsonform.js on lines 2763..2764
      lib/jsonform.js on lines 2765..2766

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

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

            if (this.formElement.onKeyUp)
              $(this.el).bind('keyup', function(evt) { node.formElement.onKeyUp(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2749..2750
      lib/jsonform.js on lines 2751..2752
      lib/jsonform.js on lines 2756..2757
      lib/jsonform.js on lines 2758..2759
      lib/jsonform.js on lines 2763..2764

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

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

            if (this.view.onClick)
              $(this.el).bind('click', function(evt) { node.view.onClick(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2749..2750
      lib/jsonform.js on lines 2751..2752
      lib/jsonform.js on lines 2758..2759
      lib/jsonform.js on lines 2763..2764
      lib/jsonform.js on lines 2765..2766

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

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

            if ((boundaries.minItems >= 0) &&
                (node.children.length <= boundaries.minItems)) {
              $nodeid.find('> a._jsonform-array-deleteitem').addClass('disabled');
            }
      Severity: Major
      Found in lib/jsonform.js and 3 other locations - About 55 mins to fix
      lib/jsonform.js on lines 933..937
      lib/jsonform.js on lines 1078..1081
      lib/jsonform.js on lines 1133..1136

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

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

            if (this.formElement.onClick)
              $(this.el).bind('click', function(evt) { node.formElement.onClick(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2749..2750
      lib/jsonform.js on lines 2751..2752
      lib/jsonform.js on lines 2756..2757
      lib/jsonform.js on lines 2763..2764
      lib/jsonform.js on lines 2765..2766

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

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

            if ((boundaries.maxItems >= 0) &&
                (node.children.length >= boundaries.maxItems)) {
              $nodeid.find('> a._jsonform-array-addmore').addClass('disabled');
            }
      Severity: Major
      Found in lib/jsonform.js and 3 other locations - About 55 mins to fix
      lib/jsonform.js on lines 933..937
      lib/jsonform.js on lines 1078..1081
      lib/jsonform.js on lines 1137..1140

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

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

            if (this.formElement.onChange)
              $(this.el).bind('change', function(evt) { node.formElement.onChange(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2749..2750
      lib/jsonform.js on lines 2756..2757
      lib/jsonform.js on lines 2758..2759
      lib/jsonform.js on lines 2763..2764
      lib/jsonform.js on lines 2765..2766

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

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

              if ((boundaries.maxItems >= 0) &&
                  (node.children.length <= boundaries.maxItems)) {
                $nodeid.find('> a._jsonform-array-addmore').removeClass('disabled');
              }
      Severity: Major
      Found in lib/jsonform.js and 3 other locations - About 55 mins to fix
      lib/jsonform.js on lines 933..937
      lib/jsonform.js on lines 1133..1136
      lib/jsonform.js on lines 1137..1140

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

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

            if (this.view.onKeyUp)
              $(this.el).bind('keyup', function(evt) { node.view.onKeyUp(evt, node); });
      Severity: Major
      Found in lib/jsonform.js and 5 other locations - About 55 mins to fix
      lib/jsonform.js on lines 2749..2750
      lib/jsonform.js on lines 2751..2752
      lib/jsonform.js on lines 2756..2757
      lib/jsonform.js on lines 2758..2759
      lib/jsonform.js on lines 2765..2766

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

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

            if ((boundaries.minItems > 0) &&
                (node.children.length <= boundaries.minItems)) {
              $nodeid.find('> span > a._jsonform-array-deletelast')
                .addClass('disabled');
            }
      Severity: Major
      Found in lib/jsonform.js and 3 other locations - About 55 mins to fix
      lib/jsonform.js on lines 1078..1081
      lib/jsonform.js on lines 1133..1136
      lib/jsonform.js on lines 1137..1140

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

      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

      Complex method ApiRequestService#post_request (27.2)
      Open

        def post_request
          url = Addressable::URI.parse(@uri.strip).normalize
          http = Net::HTTP.new(url.host, url.port || 80)
      
          if @uri.include?("https://")
      Severity: Minor
      Found in app/services/api_request_service.rb by flog

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

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

        def verify_user
          result = validate_support_id
          if result && result.code == "200" && result.body.present?
            encounter_server = SmartVillageApi.encounter_server_url
            uri = Addressable::URI.parse("#{encounter_server}/v1/support/verify_user.json")
      Severity: Minor
      Found in app/controllers/encounters_supports_controller.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

      Function initLeafletMap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function initLeafletMap(id) {
        const $parentRow = $('#' + id)
          .parent()
          .parent()
          .parent();
      Severity: Minor
      Found in app/javascript/partials/_leaflet_map.js - 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

      Severity
      Category
      Status
      Source
      Language